BASIC STRUCTURE

Both Perl and Python share the same basic rules and layout, although there are some specific differences you need to be aware of. To recap on the major points of operation for Perl:

  • Scripts are executed sequentially, on a statement by statement basis.

  • Statements must be terminated by a semicolon, statements can be separated by new lines.

  • Blocks are delimited by braces.

  • Functions can be defined before or after you use them.

  • External modules are imported during the initial stages of execution to allow syntax and error checking (see The execution model for more information on the precise execution sequence).

Python's approach

Python follows a similar approach, although it will appear to many Perl programmers as being somewhat ambiguous: ...

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.