in reply to Strange behaviour (bug?) of use strict 'subs' (was: ... strict 'vars')
(ActiveState Perl 5.6.1, Win32)> perl -w -Mstrict -e"my%f;++@f{(1,2)};die'ack'if foo eq 'bar'" Bareword "foo" not allowed while "strict subs" in use at -e line 1. Execution of -e aborted due to compilation errors. > perl -w -Mstrict -e"my%f;++@f{qw/1 2/};die'ack'if foo eq 'bar'" Bareword "foo" not allowed while "strict subs" in use at -e line 1. Execution of -e aborted due to compilation errors. > perl -w -Mstrict -e"my%f;++@f{1..2};die'ack'if foo eq 'bar'" >
a look at the code using B::Terse might help a little...
> perl -w -MO=Terse -Mstrict -e"my%f;++@f{1..2};die'ack'if foo eq 'bar +'" LISTOP (0x182015c) leave [1] OP (0x3c3f34) enter COP (0x182b404) nextstate OP (0x182b4e8) padhv [1] COP (0x1821f48) nextstate UNOP (0x3cbe14) preinc LISTOP (0x1821f84) hslice OP (0x3c40b0) pushmark UNOP (0x3c408c) rv2av SVOP (0x3c4030) const SPECIAL #0 Nullsv OP (0x1821fac) padhv [1] COP (0x3c3f64) nextstate UNOP (0x1828c28) null LOGOP (0x1828c4c) and BINOP (0x1828c74) seq SVOP (0x3c3fd4) const PV (0x182a7d4) "foo" SVOP (0x3c3fa0) const PV (0x392c20) "bar" LISTOP (0x3c3ff8) die [4] OP (0x1821ec4) pushmark SVOP (0x1821f24) const PV (0x392c08) "ack" -e syntax OK > perl -w -MO=Terse -Mstrict -e"my%f;++@f{(1,2)};die'ack'if foo eq 'ba +r'" Bareword "foo" not allowed while "strict subs" in use at -e line 1. -e had compilation errors. LISTOP (0x182015c) leave [1] OP (0x3c3f1c) enter COP (0x182b404) nextstate OP (0x182b4e8) padhv [1] COP (0x3c404c) nextstate UNOP (0x3c4088) preinc LISTOP (0x3c40ac) hslice OP (0x1821e60) pushmark LISTOP (0x1821ed8) list OP (0x3cbe14) pushmark SVOP (0x1821f24) const SPECIAL #0 Nullsv SVOP (0x1821f00) const SPECIAL #0 Nullsv OP (0x1821f48) padhv [1] COP (0x3c3f3c) nextstate UNOP (0x1828c28) null LOGOP (0x1828c4c) and BINOP (0x1828c74) seq SVOP (0x3c3fac) const SPECIAL #0 Nullsv SVOP (0x3c3f78) const SPECIAL #0 Nullsv LISTOP (0x3c3ff0) die [2] OP (0x3c3fd0) pushmark SVOP (0x3c4018) const SPECIAL #0 Nullsv >
~Particle *accelerates*
|
|---|