in reply to Help need in Miscellaneous code
Why does the following program print "Undefined!"? Shouldn't the subro +utine leave the value of $x alone? (I can understand it clobbering $_, but $ +x?) #!/usr/bin/perl -w use strict; sub readZip() { open FH, '/dev/null'; while (<FH>) { print "Got something!\n"; } } my $x = 'hi'; for ($x) { readZip(); } print "Undefined!\n" unless defined $x; (I'm using perl 5.6.1)
|
---|