Originally posted
here, on July 19, 2005, with the title "
Is this a perl bug?", and signed by someone named "Ted":
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)
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/