trisjs has asked for the wisdom of the Perl Monks concerning the following question:

Input is
#!/usr/bin/perl print "Hello World.\n"; print "Hulo";
Output is
COP (0x3327c98) nextstate .. COP (0x3327c98) nextstate COP (0x3327c98) nextstate LISTOP (0x3327d34) leave .. LISTOP (0x3327d34) leave LISTOP (0x3327d34) leave OP (0x3327cd4) pushmark .. LISTOP (0x3327cf0) print OP (0x3327cd4) pushmark SVOP (0x3327d14) const LISTOP (0x3327cf0) print OP (0x3327c58) enter .. COP (0x3327d58) nextstate OP (0x3327c58) enter COP (0x3327d58) nextstate OP (0x3327d94) pushmark .. LISTOP (0x3327db0) print OP (0x3327d94) pushmark SVOP (0x3327dd4) const LISTOP (0x3327db0) print ------- OP (0x3327c58) enter COP (0x3327d58) nextstate OP (0x3327d94) pushmark SVOP (0x3327dd4) const [2] PV (0x15150f8) "Hello World.\n" LISTOP (0x3327db0) print COP (0x3327c98) nextstate OP (0x3327cd4) pushmark SVOP (0x3327d14) const [3] PV (0x142c078) "Hulo" LISTOP (0x3327cf0) print LISTOP (0x3327d34) leave [1] Hello.pl syntax OK

Replies are listed 'Best First'.
Re: Can you explain what this B::BBlock output means
by ikegami (Patriarch) on Aug 13, 2010 at 16:17 UTC
    • Enter a scope
    • nextstate records a line number for error messages (and maybe more).
    • Start a list on the stack
    • Push constant "Hello World.\n" on the stack.
    • Print what's on the stack.
    • Start a list on the stack
    • Push constant "Hulo" on the stack.
    • Print what's on the stack.
    • Leave the current scope.

    Some variations of that output:

    $ perl -MO=Terse -e'print "Hello World.\n"; print "Hulo";' LISTOP (0x8180e38) leave [1] OP (0x8177f00) enter COP (0x8180d50) nextstate LISTOP (0x817fdf0) print OP (0x817fe20) pushmark SVOP (0x8180ee8) const PV (0x817bc10) "Hello World.\n" COP (0x8180da8) nextstate LISTOP (0x8180d30) print OP (0x8244c20) pushmark SVOP (0x8180d88) const PV (0x817bc30) "Hulo" -e syntax OK $ perl -MO=Concise -e'print "Hello World.\n"; print "Hulo";' a <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 5 <@> print vK ->6 3 <0> pushmark s ->4 4 <$> const(PV "Hello World.\n") s ->5 6 <;> nextstate(main 1 -e:1) v:{ ->7 9 <@> print vK ->a 7 <0> pushmark s ->8 8 <$> const(PV "Hulo") s ->9 -e syntax OK $ perl -MO=Terse,-exec -e'print "Hello World.\n"; print "Hulo";' OP (0x8177f08) enter COP (0x8180d60) nextstate OP (0x817fe50) pushmark SVOP (0x8180e48) const PV (0x817bc18) "Hello World.\n" LISTOP (0x8180ef8) print COP (0x8180db8) nextstate OP (0x8244ce0) pushmark SVOP (0x8180d28) const PV (0x817bc38) "Hulo" LISTOP (0x8180d08) print LISTOP (0x8180d98) leave [1] -e syntax OK $ perl -MO=Concise,-exec -e'print "Hello World.\n"; print "Hulo";' 1 <0> enter 2 <;> nextstate(main 1 -e:1) v:{ 3 <0> pushmark s 4 <$> const(PV "Hello World.\n") s 5 <@> print vK 6 <;> nextstate(main 1 -e:1) v:{ 7 <0> pushmark s 8 <$> const(PV "Hulo") s 9 <@> print vK a <@> leave[1 ref] vKP/REFC -e syntax OK
Re: Can you explain what this B::BBlock output means
by Khen1950fx (Canon) on Aug 13, 2010 at 10:19 UTC