Skip to Content
Perl To Python Migration
book

Perl To Python Migration

by Martin C. Brown
November 2001
Beginner
320 pages
5h 53m
English
Pearson Business
Content preview from Perl To Python Migration

PYTHON VARIABLES

Python is entirely object-based, this means that many Perl programmers will have to get used to working with a combination of objects, compatible operators, and the class-specific methods which can be used to manipulate them.

For example, consider the Perl code fragment below which creates an array and then sorts the results into a new array:

my @array = qw/fred bob alice/;
my @sorted = sort @array;

Within Python we can create the new list (the Python array type) and then use the sort() method on the new object to create an ordered version.

array = ['fred','bob','alice']
array.sort()

Although the process still takes two lines, we've created only one list and haven't had to exchange any data with an additional function, everything ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl in a Nutshell

Perl in a Nutshell

Nathan Patwardhan, Ellen Siever, Stephen Spainhour
Perl by Example

Perl by Example

Ellie Quigley
Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe

Publisher Resources

ISBN: 0201734885Purchase book