THE EXECUTION MODEL

Although not a vital part of your understanding of the differences between Perl and Python, understanding the similarities and differences between the two models of execution is a useful side note.

Perl

Perl's execution model, follows a very simple path. The model assumes you've just run a Perl script from a text file, which with some minor differences applies equally to the methods used for executing embedded scripts (from C/C++), in-line evaluations (through eval), and the one line scripts supplied on the command line.

Following the figure the basic execution process for Perl goes like this:

1.
Read the source code.
2.
Immediately execute any BEGIN blocks in the source.
3.
Import (and if necessary evaluate and execute) the ...

Get Perl To Python Migration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.