Is there a way to create perl source code, if I have the opcode?
For example
perl -MO=Concise -e "print 123"
will output the opcode:
6 <@> 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[IV 123] s ->5
I would like to reverse this somehow.
If by "have the opcode", you mean "have the opcode tree"
While B::Concise tries to give an accurate representation of the opcode tree, B::Deparse takes the opcode tree and produces source code from it.
It's quite good, though there are some limitations.
If by "have the opcode", you mean "have the output of B::Concise"
Given that B::Concise tries to be very complete, it might be possible, but I think some information is missing. I'm pretty sure there's nothing that tries to do this on CPAN, since I've never heard of blead breaking it (something you would expect to happen regularly).