>eg:
>
>use strict;
>my $var = 20;
>
>print "before: $var\n";
>&routine;
>print "after: $var\n";
>exit;
>
>
>sub routine {
>       $var += 1;
>> >}
>

Hi,you don't need the global vars at all.The same way,you can write it like:

use strict;
my $var = 20;

print "before: $var\n";
$var = routine($var);
print "after: $var\n";

sub routine {
    my $var = shift;
    ++$var;
}

__END__

Hope it helps.

--
Books below translated by me to Chinese.
Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/
Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to