Perl vs. Python
- Variable access -- Pyhton is easy to access the varaible
Perl Python @foo foo my $foo = 1; foo = 1 - Perl makes you type {}'s around your blocks and ()'s around your conditionals,
Perl Python if ($foo) { print "hello world"; }
if foo: print "hello, world"
if ($foo) { print "hello, world"; }
if foo: print "hello, world"
- Perl guarantees that you'll type at least one extra character at the end of every line. The ";", of course.
- The Perl Way of function/method parameters (AND setting parameter defaults)
Perl Python sub foo { my $arg1 = shift; my @rest_of_args = @_; ...do stuff... }
def foo (arg1, rest_of_args): ...do stuff...
sub foo { my $arg1 = shift || 0; ...do stuff... }
def foo (arg1 = 0): ...do stuff...
- Perl makes you type more to access object properties.
Perl Python $foo->bar(); foo.bar()
Perl is a lot older than Python and has a much wider selection modules available.
Perl is harder to handle and debug compared to Python when the code starts to grow.Easy to read and write, Large number of frameworks available for web development - (flask, web.py, django, google appengine)
No comments:
Post a Comment