COMMUNICATING WITH THE SYSTEM
The Python sys module provides us with the interface for determining information about the machine and environment in which Python is currently executing. Some of these elements are handled in Perl using built-in variables, others by built-in functions. We'll have a look at all of the compatibility information, and how to make the transition from using one system to another, as well as some of the Python specific elements.
Getting command-line arguments
Within Perl any arguments supplied to the script on the command line are supplied in the standard @ARGV variable. For example, we can accept a list of files to process using:
foreach my $file (@ARGV) { print "Processing $file\n"; ... }
Under Python you must import ...
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.