I've gone through several old mailing list posts so maybe I've missed the
reasoning here, but back in March 2004 code was added for the following
case..
$ perl -wle'my $zam if 0'
Deprecated use of my() in false conditional at -e line 1.
I've strained my brain to see if I remember a reason for this case to warn
while a case where an assignment is done does not warn. For example...
$ perl -wle'my $zam = "clunk_eth" if 0'
Both, however, have identical behavior.
$ perl -wle'sub kapow { my $zam if 0; $zam++ } print kapow(); print
kapow(); print kapow();'
Deprecated use of my() in false conditional at -e line 1.
0
1
2
$ perl -wle'sub kapow { my $zam = "clunk_eth" if 0; $zam++ } print kapow();
print kapow(); print kapow();'
0
1
2
Steve Peters
steve@fisharerojo.org
Thread Next