Bowie Bailey <[EMAIL PROTECTED]> wrote on 07/27/2005 01:47:12 PM:

> Exactly right.  You can't use a symbolic reference to refer to a lexical
> variable (declared with "my").  Try this code:
> 
> $test = 'global test';
> my $test = 'lexical test';
> my $name = 'test';
> $result = $$name;
> print "$result\n";
> 
> You'll see that you get the value of the global $test variable as the
> result.
> 

Replacing 'my' with 'our' will declare the variable globally and "use 
strict 'vars'" won't complain.

use strict 'vars';
our $test = 'another global test';
my $name = 'test';
my $result = $$name;
print "$result\n";

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to