f******y 发帖数: 2971 | 1 For example, I dont want the following script to compile. One way to do it
is to put all subroutines to the head of the file. That is not convenient
most of time. I tried to use another package, it still can read $a.
use strict;
my $a = 0;
package Function; #This does not stop it.
sub read {
return($a + 1);
} | f******y 发帖数: 2971 | 2 Another ugly way to do it. This is still not nice. I want to know if there
is something we can declare in use clause, something like:
use xxxxxx;
{
use strict;
my $a = 0;
}
sub read {
return($a+1);
}
【在 f******y 的大作中提到】 : For example, I dont want the following script to compile. One way to do it : is to put all subroutines to the head of the file. That is not convenient : most of time. I tried to use another package, it still can read $a. : use strict; : my $a = 0; : package Function; #This does not stop it. : sub read { : return($a + 1); : }
|
|