Thanks for your answer! But, my problem is, i must see this variable after the call of the sub. I'm sorry for the first example, it was inaccurate. But this is ok (I think) :) (because I have a lot of variables, which I must change in the sub, I want to define they as "global" inside my parent-routine (in the example: the programm, but by me: the parent-sub)).
Thanks for all, Raphael eg: use strict; my $var = 20; print "before: $var\n"; &routine; print "after: $var\n"; exit; sub routine { $var += 1; > >} On Mon, Oct 16, 2006 at 07:36:13PM +0800, Jeff Pang wrote: > > > > >eg: > > > >use strict; > >my $var = 20; > > > >print "$var\n"; > >&routine; > >exit; > > > > > >sub routine { > > print "$var\n"; > >} > > > > Hi,you can do it by passing the vars to the subroutine like: > > my $var = 20; > &routine($var); > > sub routine { > my $var = shift; > print $var; > } > > -- > 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> > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>