The Perl virtual machine is a stack-based process virtual machine implemented as an opcodes interpreter which runs previously compiled programs written in the Perl language. The opcodes interpreter is a part of the Perl interpreter, which also contains a compiler (lexer, parser and optimizer) in one executable file, commonly /usr/bin/perl on various Unix-like systems or perl.exe on Microsoft Windows systems.
The Perl compiler outputs a compiled program into memory as an internal structure which can be represented as a tree graph in which each node represents an opcode. Opcodes are represented internally by typedefs. Each opcode has next / other and first / sibling pointers, so the opcode tree can be drawn as a basic OP tree starting from root node or as flat OP list in the order they would normally execute from start node. Opcodes tree can be mapped to the source code, so it is possible to decompile to high-level source code.[1]
Perl's opcodes interpreter is implemented as a tree walker which travels the opcode tree in execution order from the start node, following the next or other pointers. Each opcode has a function pointer to a pp_opname function, i.e. the say opcode calls the pp_say function of internal Perl API.
The phase of compiling a Perl program is hidden from the end user, but it can be exposed with the B Perl module[2] or other specialized modules, as the B::Concise Perl module.[3]
An example of a simple compiled Hello world program dumped in execute order (with the B::Concise Perl module):