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?
In reply to Re: 'my' buggy...
by Molt
in thread 'my' buggy...
by december
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |