in reply to Perl bytecode

Perhaps B::Concise produces something like you want? An example from its documentation:

% perl -MO=Concise -e '$a = $b + 42' 8 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 7 <2> sassign vKS/2 ->8 5 <2> add[t1] sK/2 ->6 - <1> ex-rv2sv sK/1 ->4 3 <$> gvsv(*b) s ->4 4 <$> const(IV 42) s ->5 - <1> ex-rv2sv sKRM*/1 ->7 6 <$> gvsv(*a) s ->7

Replies are listed 'Best First'.
Re^2: Perl bytecode
by mulander (Monk) on Dec 06, 2005 at 15:52 UTC
    Thank you both for anwsers.
    Fletch you hit the bull's eye, It is exactly what I wanted to obtain.
    Thank you again for the time and trouble.
    Next time I will try harder searching my own anwser, as It seems that it was just under my nose.
      With the -exec flag, B::Concise gives output closer to your example:
      $ perl -MO=Concise,-exec -we'print "Hello, world!\n";' 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 <@> leave[1 ref] vKP/REFC -e syntax OK
      by showing execution order rather than the op tree (but no longer shows optimized-away ops and can make branching ops less clear).