in reply to Re: Evil Interview Questions
in thread Evil Interview Questions

Nope. I have a pre-5.6.1 Perl and it behaves the same as 5.8.8

Maybe you need something even older?

Replies are listed 'Best First'.
Re^3: Evil Interview Questions
by lodin (Hermit) on Feb 09, 2008 at 00:22 UTC

    I'm quite surprised. I used ActivePerl 5.6.0 back then, but I don't think that the distribution would make any difference. Maybe I'm just mixing this up with something closely related.

    perl561delta agrees with me though that ...

    Could you provide B::Deparse output of your code for 5.6.0 and 5.6.1? B::Deparse had plenty issues of its own back then, but it will probably be interesting.

    lodin

      Sure thing. I include a optree dump too (Terse for 5.6.0 since Concise wasn't found.)

      (I emptied the body for terseness after making sure it didn't affect the result.)

      5.6.0:

      >c:\progs\perl560\bin\perl -v This is perl, v5.6.0 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary build 635 provided by ActiveState Corp. http://www.ActiveState. +com Built 15:34:21 Feb 4 2003 ... >c:\progs\perl560\bin\perl -MO=Deparse -e"for my $s ( qw( a b c ) ) {} +" foreach my $s ('a', 'b', 'c') { (); } -e syntax OK >c:\progs\perl560\bin\perl -MO=Terse -e"for my $s ( qw( a b c ) ) {}" LISTOP (0x184fcc4) leave [1] OP (0x184fca4) enter COP (0x184fd10) nextstate BINOP (0x184fd4c) leaveloop LOOP (0x1828b24) enteriter [1] OP (0x184ff6c) null [3] UNOP (0x184fe9c) null [141] OP (0x184fe7c) pushmark SVOP (0x184ff10) const SPECIAL #0 Nullsv SVOP (0x184fec8) const SPECIAL #0 Nullsv SVOP (0x184fe48) const SPECIAL #0 Nullsv UNOP (0x184fd74) null LOGOP (0x184fd98) and OP (0x1828b8c) iter LISTOP (0x184fdc0) lineseq OP (0x184fe28) stub OP (0x1828b6c) unstack COP (0x184fdec) nextstate -e syntax OK

      5.6.1:

      >c:\progs\perl561\bin\perl -v This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary build 635 provided by ActiveState Corp. http://www.ActiveState. +com Built 15:34:21 Feb 4 2003 ... >c:\progs\perl561\bin\perl -MO=Deparse -e"for my $s ( qw( a b c ) ) {} +" foreach my $s ('a', 'b', 'c') { (); } -e syntax OK >c:\progs\perl561\bin\perl -MO=Concise -e"for my $s ( qw( a b c ) ) {} +" e <@> leave[$s:5,7] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 7 -e:1) v ->3 d <2> leaveloop vK/2 ->e 7 <{> enteriter(next->9 last->d redo->8)[$s:5,7] lK ->b - <0> ex-pushmark s ->3 - <1> ex-list lKPM ->7 3 <0> pushmark sM ->4 4 <$> const(SPECIAL Null)[t2] sM ->5 5 <$> const(SPECIAL Null)[t3] sM ->6 6 <$> const(SPECIAL Null)[t4] sM ->7 - <1> null vK/1 ->d c <|> and(other->8) vK/1 ->d b <0> iter s ->c - <@> lineseq vK ->- 8 <0> stub v ->9 9 <0> unstack v ->a a <;> nextstate(main 7 -e:1) v ->b -e syntax OK
      A quick look at the docs shows that qw-as-a-list has been around since 5.6.0.

        ... and my quick look was a bit too quick. Usually the perl5XYdelta documents only document the changes between Perl 5.X.Y and 5.X.0, but perl561delta is an exception. It actually documents the differences between 5.6.1 and 5.005. I've updated my first reply to say 5.6.0 instead of 5.6.1. Hopefully that can be verified. :-)

        lodin