Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Strange behaviour (bug?) of use strict 'subs' (was: ... strict 'vars')by Hofmator (Curate) |
on Jun 23, 2002 at 12:09 UTC ( [id://176589]=perlquestion: print w/replies, xml ) | Need Help?? |
Hofmator has asked for the wisdom of the Perl Monks concerning the following question: Just the other night I came across the following. Consider both ways to assign to a hash slice work fine and produce the same results as expected. Now add the following line to it:die "strange .." if foo eq 'bar'; which should make perl barf a "use of bareword 'foo' " error - as we are under strict. But it doesn't!! At least for me. I tried this under Perl 5.6.0 (ActivePerl Build 623) on Windows and Perl 5.6.1 on Linux (2.2.14). If you remove the first hash slice line (@foo{1..3} = ();) then it works (or better not works i.e. throws the bareword error) correctly. Well, so my questions are:
-- Hofmator 2002-06-23 Edit by Corion : Changed title
Back to
Seekers of Perl Wisdom
|
|