Anthony Ettinger wrote: : #!/usr/bin/perl -w : : use vars qw($foo); #globals; : use strict; : : sub foo { : $foo = 'foo'; : my $baz = 'baz'; : } : : my $baz = 'pre-baz'; : foo(); : : print $foo, "\n"; : print $baz, "\n";
I think the problem we are having is why use a solution which resorts to global variables when lexical variables get the job done fine? use strict; use warnings; my $baz = 'pre-baz'; my $foo = foo(); print $foo, "\n"; print $baz, "\n"; sub foo { my $foo = 'foo'; my $baz = 'baz'; return $foo; } __END__ HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>