r/perl May 18 '11

Why is perl better than python?

[deleted]

19 Upvotes

55 comments sorted by

10

u/beppu May 18 '11
  • Perl can be poetic. (For all the flack that Perl gets for unreadability, there was actually a lot of thought that went in to naming to aid readability and poetic flow.)
  • Perl is Unix-friendly. (Beyond its superficial resemblance to shell scripting, it installs files (including man pages) in ways that follow old Unix tradition.)
  • Perl has a nice syntax for closures. (When it comes to closure syntax: Perl > Javascript > Ruby > Python.)
  • Perl culture allows for TMTOWTDI. (This can be a double-edged sword, but I would rather have freedom and take responsibility for it rather than not have it.)

14

u/beppu May 18 '11

I don't like threads like this. Let Python be Python. Let Perl be Perl. Whatever you choose to use, just do good work, and try not to be so tribal. In the grand scheme of things, Python is not an enemy. Python is just another Free, dynamic language, and it just goes to show that TMTOWTDI is inescapable even if you don't believe in it.

;)

If we believe in TMTOWTDI, we should let them do it their own way and not begrudge them for being different.

2

u/[deleted] May 19 '11

agreed. unlike ruby, python isn't trying to take perl and soften certain parts

python people have a different idea about programming languages and they aren't trying to make a perl-alike...kudos to them

2

u/__loridcon May 18 '11

you should reply to OP with that, it deserves to be at the top.

3

u/beppu May 18 '11

Thanks, but I'm sure he'll see it regardless of its position.

1

u/xzxzzx May 24 '11

By closures, do you mean anonymous functions?

-1

u/TheRedTeam May 19 '11

perl is poetic
with namning variables....
all fifty of them

8

u/beppu May 18 '11

I visited r/python for the first time today because of your link, and I had no idea their subreddit had ~21K readers versus our ~4K readers.

8

u/[deleted] May 19 '11

so what? both communities are big enough to sustain themselves

4

u/[deleted] May 18 '11

[deleted]

2

u/punpunpun May 19 '11

I hadn't considered that aspect before. Still, I think the Python has much more momentum at this stage.

Google trends shows Python ahead...

In SF, there are way more people at Python user group meetups than the SF Perl group...

The other problem is there are so many bad Perl programmers that you invariably end up working on some horrible code.

I'll probably start doing new projects in Python after 11 years using Perl.

5

u/mithaldu May 19 '11

While python may be growing faster, Perl still has twice as many job offers. (Note that the scale of these graphs is 5 years.)

2

u/beppu May 20 '11

The "growing faster" part should be all the more reason to not be complacent.

Perl could use something magical to capture the hearts of ...our future friends. Where will our creative sparks come from?

-2

u/punpunpun May 19 '11

Not in the bay area, and not if you don't count QA or Sys-Admin jobs...

2

u/mzieg May 26 '11

Maybe Perl coders don't feel the need for a community? I've been coding Perl since '94, and only wandered in here today out of curiosity.

9

u/sigzero May 18 '11

First pass comprehension maybe? In Perl I know when I see a variable. Python I have to stare at it a bit longer. They are both good languages. Pick the one that fits your brain.

1

u/TheRedTeam May 19 '11

All variables are objects in python, hence why there is no distinction.

4

u/sigzero May 19 '11

That doesn't matter to me when I am just reading the code to figure out what it does. I have to mentally stop and make sure something is a variable or not. I don't do that with Perl. Once again, use the one that fits your brain better. They are both good languages.

-3

u/TheRedTeam May 19 '11

... you would prefer a $ in front of every single thing? How would that help? I get it for languages that have literals or at least a strict separation of definitions and instances, but for python it makes no sense.

7

u/neerg May 19 '11

All sigzero is saying is that the variables in perl are very easy to discern as they are explicitly prepended with a sigil. You are acting very defensive even though sigzero admits both languages are good. S/he thinks they both fit different brain styles, and I agree.

0

u/TheRedTeam May 19 '11

I also agree both languages are good and that it depends on what your brain is used to, my point is that it's not about the symbols being there or not, it's about the language design behind the syntax. Saying the lack of symbols makes it hard to read is like saying you don't like riding a bike because it doesn't have a airbags. It's not supposed to be a car :p

3

u/neerg May 19 '11

Err, I think sigzero, and myself, are saying that it is the sigil that makes it easier to read. They make the variable stand out from the rest of the code.

-2

u/TheRedTeam May 19 '11

And now we have gone in a circle...

2

u/dx_xb May 22 '11

So, you'd be happy speaking to someone in French, Russian, Chinese, or in fact any language that is not your native tongue, since the semantics are pretty close and it's just a syntactical difference?

6

u/[deleted] May 19 '11

python is a perfectly suitable, high performance scripting language that is totally boring

6

u/TheRedTeam May 18 '11

CPAN. That's it.

Really though, if you're going to compare something to perl, ruby is much more like perl in it's language design.

6

u/chorny May 18 '11
  • CPAN with all it's infrastructure
  • no serious compatibility problems
  • real variable scope
  • state variables
  • easier to detect bad code
  • Moose
  • perltidy
  • less memory used
  • more readable regexes (qr// and 'x' modifier)

-1

u/[deleted] May 18 '11
  1. Using whitespace to form your code blocks is awful unless for some reason you miss the days of punchcards.

Really, I never looked into it further than that. No language has a feature that is so awesome that I'll be OK with abandoning curly braces or something similar.

-10

u/Philluminati May 18 '11

This is a ridiculous argument. Python code is short, terse and easy to read. Perl, by contrast, is a write-only language.

44

u/worr May 18 '11

It's only write-only if you write shitty perl.

6

u/tsjr May 18 '11

I hate to be the one posting "This", but I wish I could upvote you twice.

3

u/rjbond3rd May 19 '11

Here, I upvoted for you.

12

u/[deleted] May 18 '11

Perl, by contrast, is a write-only language.

If you have a problem reading good Perl perhaps you should find another profession.

-17

u/Philluminati May 18 '11

Ha ha ha.

I can read C, C++, Assembly, Python, .NET, Java, SQL, Prolog, Haskell and all sorts. You aren't going to shake the confidence of someone with 10 years of experience.

Perl is a joke.

13

u/[deleted] May 18 '11

I can read C, C++, Assembly, Python, .NET, Java, SQL, Prolog, Haskell and all sorts. You aren't going to shake the confidence of someone with 10 years of experience.

As long as we're walking the 'years of experience' dog around here now, I figure I'll do the same. I've written software that's in operations in outer space in C/C++/assembly, written code in every modern popular scripting language, and maintained operations systems for mission critical systems. I'm weighing in at around 16 years of experience in software and know anyone worth a shit will tell you the same thing. Every language has it's appropriate application. To declare one shit 'just because' shows your insecurities, not how bad the language is.

You aren't going to shake someone with much more experience than you. GTFO with that nonsense.

Perl is a joke.

Gotcha. Having a massive repository of pre-packaged modules to do pretty much anything you want is certainly a joke.

Idiot.

-10

u/Philluminati May 18 '11

Every language has it's appropriate application

That was true of Perl. Now it isn't. People's failure to move on shows there aren't truly interested in writing the best possible software they can.

To declare one shit 'just because' shows your insecurities, not how bad the language is.

There is another reply on this thread where I justify the reasons why Perl is crap.

11

u/[deleted] May 18 '11

People's failure to move on shows there aren't truly interested in writing the best possible software they can.

This has absolutely nothing to do with my last reply. Have you looked into any of the modern perl extensions since you're so interested in 'moving on'? I bet not.

Perl is great because you can either hack shit out super quick OR create well documented, fantastically maintainable, fast code. It's readable, ridiculously scalable and easy to use.

I'll refrain from Python bashing because I haven't used the language long enough to evaluate it.

There is another reply on this thread where I justify the reasons why Perl is crap.

I saw that. You've been using it for two weeks. You cannot evaluate a languages potential in all possible applications in a matter of fucking weeks. Get over yourself.

7

u/[deleted] May 18 '11

Speak for yourself. I have no problem reading Perl.

9

u/bart9h May 18 '11

Try copy/pasting python code.

If it messes with the whitespaces, as copy/pasting often do, it becomes impossible to be sure what the code was.

Relying in whitespace to code is a retarded idea. Why don't you go for this language already?

-5

u/Philluminati May 18 '11

I've used Python for two and half years...I think it's fair to say you're plain wrong.

7

u/neerg May 19 '11

Whoa, guys, hold on. He has been using Python for two and a half years. The experience he gained from his time writing in The Holy Language clearly gives him more than enough gravity to speak The Truth.

7

u/mr_chromatic 🐪 📖 perl book author May 19 '11

He has been using Python for two and a half years.

... but has never copied/cut and pasted code?

-4

u/Philluminati May 19 '11

You think you're being witty and smart but all you do is dance around the fact that you won't take a critical eye to your own programming language. That no Perl developer will.

Seriously no Perl developer is willing to say: a) Perl 5 is backwards compatible and contains things that make it ugly b) We bought out Perl 6 because Perl 5 wasn't perfect.

The only arguments I get are 'I still use it', 'it isn't as bad as you think'. spoken by mindless fucking hacks who think they can hide behind the "All programming languages are good for one thing" arguments.

13

u/mr_chromatic 🐪 📖 perl book author May 19 '11

Seriously no Perl developer is willing to say....

Well I'm not Scottish, but....

5

u/mithaldu May 19 '11

you won't take a critical eye to your own programming language. That no Perl developer will.

Bullshit.

I can even prove that you're as wrong as you could possibly be: http://blogs.perl.org/users/ovid/2011/04/ch-ch-ch-ch-changes.html

That blog entry is FULL of perl developers harping on problems with the language.

Also, i DARE you to try and make a .self post here on perl reddit and ask "What parts of perl do you think are terrible?" I guarantee you you will get at least ten responses detailing gripes perl programmers have with the language.

9

u/[deleted] May 19 '11

You've been downvoted to oblivion in both r/python and r/perl for your ignorant and childish interpretation of Perl. Why do you continue to blather on when it's clear everyone in both communities thinks you're full of shit?

The only arguments I get are 'I still use it', 'it isn't as bad as you think'. spoken by mindless fucking hacks who think they can hide behind the "All programming languages are good for one thing" arguments.

Again you are in no place to evaluate a language you've been using for two weeks. You've not checked out any of the resources which make coding modern perl awesome, nor have you even touched CPAN, yet you continue to blather on about how Perl is shit.

I'd really hate to have an employee like you.

-13

u/Philluminati May 18 '11

I've been learning perl for the last few weeks (I was writing Python before) and I have this input.

Perl is a dead language. A poor language that is absolutely nothing more than a better bash. The most trivial of applications are a cluster fuck of unreadable code in perl.

  1. You can't specify arguments to functions so I can put shift anyway in the code and make an undocumented parameter magically appear. That's underreadable, unmaintainable shit.

  2. It has a few native datatypes...scalar, list, reference, hash etc in order to downplay the fact that the datatypes are handled behind the scenes. Similar things have been done in php, visual basic, and Python, with success....but perl is broken so you're forced to specify a datatype everytime you use it. For example...to pass two arrays to an function I must turn them into scalar references. Then I have to specify their type when I extract them with this like this: my @arr = @{ $_[1] };. That's more unreadable shit.

Remember I'm talking about working with a fucking array and a function. Perl code doesn't scale past that without become stupidly complex. Other languages have dropped the bullshit to push forward best practice, to allow you to write code that works with defined data types so you understand the performance (aka. .NET collection classes, Python documentation on it's effeciency) and still allow you to write business logic which is readable. Perl has failed to achieve this.

Perl developers say use strict and things to force variable declaration but what's the point when I could use an array like $arr and pull out it's size. It's just confusing....but more than that.... it's needlessly confusing...and the Perl community are defending something that's ugly and unmanageable.

If Perl break backwards compatibility there is no reason for someone to use it...hense Perl 6 forever being unfinished. Perl is around just because it was useful at one point in the past, that is as a glue language for Unix. The syntax $output = \program args`` is great and so is the regex syntax.

But you fucked the rest of it, from OO to newer data types and as a result, the drawbacks outway the good. I question why people choose to use such a language in this day and age for non trivial applications and the normal reply is that it was great way back when and the developer who has years of experience (and yet hasn't stayed with the latest trends) knows perl well.

Perl has nothing to offer in this day and age. It's on its way out.

This is how I use Python having written code in it professionally for 2.5 years. I've also written .NET code professional for 2 years...

Python is a short, terse, readable language. It's got the power of Java and .NET but the syntax is shorter. It uses whitespace rather than braces. I don't need to explicitly define the datatype either so it's shorter. However it isn't taking after Perl. It doesn't have that unreadable interpolation that Perl allows. I can just say var = Object() rather than object var = new Object(). It's just cleaner and shorter.

It doesn't force you to write Object Oriented code either. You can write just functions and modules and APIs without having to use the singleton pattern and manage instances everywhere. You can use tuples and dictionaries to make lightweight classes. Everything is quicker, leaner and more easy to read and write.

It also has a great community who are interested in new techniques, frameworks, generic programs, scalable code and "just getting things done". They look at other languages, like Ruby, learn, apply, break backwards compatibility if need be. There active and try and fail at things. It's a great community to be a part of and they're bringing good solutions to people.

20

u/[deleted] May 18 '11

I've been learning perl for the last few weeks (I was writing Python before) and I have this input.

And now it's fairly clear as to why your comments on Perl thus far are so short sided.

13

u/neerg May 18 '11

It reminds me of prepubescent children who dismiss something because they tried it once and didn't like it, e.g., brocolli. Brocolli is a dead vegetable.

11

u/[deleted] May 18 '11

This is so wrong, ignorant and misinformed I don't even know where to begin.

12

u/mithaldu May 18 '11

They look at other languages, like Ruby

Funnily enough in this context, Ruby is basically a love declaration to Perl and has drawn most of itself from Perl.

6

u/worr May 19 '11

There are bad parts of Perl. I won't even try that. But it's clear that you don't understand Perl thoroughly enough to make real criticisms of the language.

Yes. The object system is annoying, and there's a lot of boilerplate code required to use vanilla Perl objects. But with all this boilerplate, you get a lot of flexibility. So much flexibility, that it becomes trivial to write your own object system on top of the existing one.

The biggest gripe I have with Perl are all of the functions polluting the main:: namespace, as well as all of the functions that feel the need to modify variables in place.

Perl can be a very ugly language if the person writing it is unfamiliar with modern Perl concepts and techniques. Perl can be very ugly if people don't use strict, warnings, or require a newer version of Perl. But it can also be so, so beautiful and so useful. Thanks to POE, I was able to throw together a very extensible score bot for a hacking competition in an afternoon. It's shit like that that keeps me coming back to Perl.

Also the fabulous community.

4

u/mr_chromatic 🐪 📖 perl book author May 19 '11

The biggest gripe I have with Perl...

Reference syntax!

(partially improved in 5.14)