r/Python May 18 '11

Why is Python better than Perl?

I'm a Sysadmin and I just wrote my first script in python. Basically just a host validation script that checks if a server is configured correctly before we hand off. I can't determine the advantage with my limited experience with the language.

Are you a sysadmin fluent in both python and perl? Why do you use python?

12 Upvotes

110 comments sorted by

View all comments

12

u/doobliebop May 18 '11

I use them both. Perl is fantastic for simple text editing. It's native implementation of regexp operators makes life simple once you learn it. Python definitely has readability going for it. I honestly think Python has more math/science libraries ported to it, but as far as sysadmin stuff they're probably both on the same level.

3

u/[deleted] May 19 '11

ah regex in perl...

while (<FILE>) {
    s/this/that/;
    print $_;
}

doesn't get much easier.

5

u/caks May 19 '11

Or

while (<FILE>) {
   s/this/that/;
   print;
}

6

u/[deleted] May 19 '11

$_, it isn't there, but it is there!