Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Evil Interview Questions

by lodin (Hermit)
on Feb 08, 2008 at 22:39 UTC ( [id://667092]=note: print w/replies, xml ) Need Help??


in reply to Evil Interview Questions

Regarding the last question and different Perl versions:

Update: corrected version number.

lodin

Replies are listed 'Best First'.
Re^2: Evil Interview Questions
by ikegami (Patriarch) on Feb 08, 2008 at 22:59 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://667092]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (1)
As of 2024-04-18 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found