in reply to 'my' buggy...
Okay, had a proper bit of playing with this and it's looking like the symbolic reference is getting the global value. As an example look at the code below.. uncomment as needed!
#!/usr/bin/perl $::test = 'Global'; test(); sub test { my $test = 'Local'; my $line = 'test'; # This returns 'Global'. # print ${$line}."\n"; # This returns 'local' # $line =~ s/\w+/${test}/gi; # This returns 'Global' # $line =~ s/(\w+)/${$1}/gi; print "$line..\n"; }
Does anyone know if this is a known thing with symbolic references? Does it effectively do a $::test?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: 'my' buggy...
by Elian (Parson) on Apr 30, 2002 at 16:38 UTC |