N
Nathan
Hi,
I'm running Perl v5.8.8 compiled for linux. I was reading about the perl
debugger and ran the following script with the command "perl -d":
1 #!/ usr/bin/perl
2 $_ = "foo";
3 /foo/;
4
5 print "$&";
6 print "\n";
As expected it prints "foo" before the newline, and if I check the value
of $& in the debugger it does show "foo". However, if I omit line 5 of
the program then the debugger says $& is undefined when it reaches the
last print statement. I don't understand how this can be, is there some
subtlety to the way the debugger treats dynamically scoped variables?
Any insight anyone can offer would be great, thanks.
-Nathan
I'm running Perl v5.8.8 compiled for linux. I was reading about the perl
debugger and ran the following script with the command "perl -d":
1 #!/ usr/bin/perl
2 $_ = "foo";
3 /foo/;
4
5 print "$&";
6 print "\n";
As expected it prints "foo" before the newline, and if I check the value
of $& in the debugger it does show "foo". However, if I omit line 5 of
the program then the debugger says $& is undefined when it reaches the
last print statement. I don't understand how this can be, is there some
subtlety to the way the debugger treats dynamically scoped variables?
Any insight anyone can offer would be great, thanks.
-Nathan