10 ms·
...don't get mad for the question, but: anybody has any arguments for using Perl instead of, let's say Python, these days? (besides the "I already know it incre
by nnq 14y ago
...don't get mad for the question, but: anybody has any arguments for using Perl instead of, let's say Python, these days? (besides the "I already know it incredibly well" argument)
...cause the lack of an answer to such a question has only one conclusion: the language is dying, even if this is not already happening in a visible way!
(don't get me wrong, I'm not a Perl hater, and fyi, I think the world would be a much better place if Rasmus Lerdorf would have learned Perl and written a nice Perl web framework instead of inventing PHP :) )
- drucken 14y ago- CPAN - efficient and compact regex scripts - one-liners. Of course, some of these could be considered a reason NOT to use Perl depending on your specific circumstances.
- nnq 14y agoCPAN ~ pypi ~ rubyforge. Ruby allows you to write decent one-liners too, though people don't like to use it this way. the only argument I can extract from this is "Perl has a much nicer syntax for working with regexps", and I agree with this (and I hate it when other languages don't fully embrace regexps and treat them as first class citizens). but that's the thing, not even the "reasons not to use it" are unique to Perl any longer: heck, if you want to write incomprehensible code for "job security" reasons, Ruby gives you enough rope to hang the whole neighborhood (and Python too has a "dark side", but fortunately most people don't know or want to learn about it)
- falsedan 14y agowork uses pypi every day, and I had to set up a caching proxy because mirrors are frequently unavailable. It was inconceivable coming from CPAN that the major package distribution network for a major language may be down.
- mgkimsal 14y agoOT but I think it's one of the reasons mandrake/mandriva never quite took off. There was never a great centralized repository network you could count no - I grew tired of using the PLF system to grab a list of mirrors, and having to update it all the time because participating mirrors were offline or defunct after a few weeks/months.
- Ologn 14y agoI had to deal with the major third party, more or less essential, Ruby and RoR gems a few years ago. Rubyforge was a part of this constellation of essential third party gems. Dealing with gems was definitely dependency hell, with mixed up cross dependencies, which were dependent on certain versions of other gems, that were sometimes conflicting when there were a number of gems. Also, you would go to the main Ruby web pages and click links to documentation and the links would be broken - not some obscure, old documentation page to another old, obscure module, but from central help web pages to other pages of central importance. I have used CPAN for many years and it is so much more rock solid and automagic. If a mirror is down it jumps to the next one without a beat. The CPAN modules are great too. I was using XML:Simple recently, but the XML files got too big. So I looked around a little and started using XML:Twig, which works great. Then I needed to sort alphabetically words in a variety of languages. So I went with Sort:ArbBiLex which allows me to create my own sort dictionary and has suggested Western language dictionaries on the documentation page. And yes, it has a cmp call which allows for easy multi-column sorting. For whatever problem I have, it seems someone has already written a module for it, which I can get going with little effort.
- yxhuvud 14y agoBundler helps a lot though when it comes to managing the gem dependency hell.
- wazoox 14y agoPython significant white space. Really, that's what preventing me for ever liking Python.
- coldtea 14y agoGet an editor that shows whitespace. (Non)Problem solved. Not to mention you should indent your code exactly the same way (in a consistent format, either tabs or spaces) with how you'd indented Python code.
- jeremyjh 14y agoIt isn't totally solved. For example, you cannot write a lambda that contains a line-break. Its not a big problem, but it is a trade-off.
- nnq 14y agosignificant whitespace is not why you cannot write a lambda that contains a line-break. the problems are not really related. just ditch the difference between statements and expressions and allow multi-line expressions. true, then it will no longer be Python but a whole different language :)
- brendoncrawford 14y agoPut this in a text editor and run it in python: print(reduce((lambda x, y: x + y), xrange(10))) print(reduce((lambda x, y: x + \ y), xrange(10))) HINT: It runs.
- sylvinus 14y agoOpinions on Python aside, I'd never hire somebody saying something like that at an interview, even about a language I don't like. You should really look past petty details when evaluating any tech and come up with actual arguments.
- nnq 14y ago
- mhd 14y agoSo it's dying, but not visibly? I can't really parse that, but I bet the answer will contain quite a few Perl 6 references…
- nnq 14y agoI use "visibly dying" for a technology that people are migrating away from - this usually generates things like blog posts titled "X is moving away from RoR because it's crap and rewriting their stack in new fangled scala framework". But there are other ways something like a language can die in: no new projects get written in it, no new programmers learn it etc. ...this is a slow "death in silence and darkness" (think Pascal).
- mhd 14y agoI see what you mean. And just a few years ago I would've agree that this applies to Perl. But then we got projects like Moose, Dancer, Mojolicious, the whole "Modern Perl" movement and a renewed focus on Perl 5 (very regular releases). I think a part of the community was waiting for Perl 6 and thus everything was a bit stagnant, but lately I don't get that feeling anymore. It feels closer to Firefox, which is showing some renewed vigor lately, than to e.g. Tcl (sadly…). This isn't really the only presentation/post about this. After all, it's not like Django and Rails receive the same amount of hype as they did in the beginning, so if you're just going by that, we probably all should switch entirely to Go and Node…
- knotz 14y agoIt's a very fun language to begin with. Which is not unimportant if you want to keep being motivated after three decades being a programmer. Peter Norvig described 7 features which made Lisp different. Perl shares 6 of them. Important features like first-class functions, dynamic access to the symbol table, and automatic storage management. (source "High Order Perl" by MJ Dominus).
- nnq 14y agowell, putting aside things "dynamic access to the symbol table" or run-time ast manipulation types of black magic, first class functions and "automatic storage management" are available in both Python, Ruby (...yeah, you need to twist your mind towards thinking in blocks/procs as first class functions, which annoys the hell outta me, but doesn't seem to be a problem for others) and most other "dynamic" languages.
- edwinnathaniel 14y agoUniversal on NIX systems. Python has a few 2.x versions depending on the Distros. Some distros may opted to go 3.x only. Ruby isn't necessarily universal on NIX systems. Perl is.
- wazoox 14y agoArch Linux now ships Python3 only. That's quite a problem, because many things still depend on Python 2.x (for instance building Firefox from source).
- PommeDeTerre 14y agoSo download the latest Python 2.7.x source code and install it yourself. Python is extremely easy and quick to build from source on Linux.
- autarch 14y ago...don't get mad for the question, but: anybody has any arguments for using Python instead of, let's say Ruby, these days? (besides the "I already know it incredibly well" argument) ...cause the lack of an answer to such a question has only one conclusion: the language is dying, even if this is not already happening in a visible way! (don't get me wrong, I'm not a Python hater, and fyi, I think the world would be a much better place if David Heinemeier Hansson would have learned Python and written a nice Python web framework instead of inventing Rails :) )
- bryanl 14y agoRuby doesn't have great support for math, science or AI. There are projects out there trying to make the ecosystem better, but currently it trails Python.
- dasmoth 14y agoFor biology -- especially the genomics side -- Perl was absolutely dominant 10 years ago. It's been gradually edged out by other things (substantially Python and R) since then. Desire for better statistical tools may be a driver here, but it's interesting that it's led to a switch of languages rather than building more stats tools for Perl
- gajomi 14y agoI would say that Perl is still dominant in computational genomics. About a year ago I wrote some code to do some basic comparative analysis at the genome level alongside some more gene focused phylogeny efforts. Since the whole thing was quite simple it wasn't a problem to write the overall structure, but getting the bioinformatics Python libraries working was a pain. Even if the code tiself was Python the API was littered with various Perl and Bash idioms and there was a major bug in at least one of the tree building methods (had to patch it myself). Calls to subprocesses within the libraries (a heavy part of most bioinformatics work, where there are thousands of stand alone command line programs) would often fail without warning. The state of the art in this area is definitely behind Ruby and far behind Perl. However, Python is still my main language and I am very happy with that. The numpy/scipy stack and everything building around that is incomparable to anything in Perl of Ruby. Also for the last month or so I have been doing work in the IPython notebook. It has really helped my productivity and documentation efforts. And it looks really cool.
- deleted 14y ago[deleted]
- eCa 14y agoThat question can be turned around: Why should someone use Python (or Ruby) instead of Perl? For someone who hasn't used any of those, I'd say give each of them a few hours and see which style suits you best. Of course, try to find modern examples to learn from. When it comes to Perl that means: * Mojolicious [1] (or Dancer [2]) as the web framework * DBIx::Class [3] as the ORM (maybe with some sugar [4]) * Moose [5] (or Mouse or Moo) as the object system [1] http://mojolicio.us/ http://mojolicio.us/ [2] http://www.perldancer.org/ http://www.perldancer.org/ [3] https://metacpan.org/module/DBIx::Class https://metacpan.org/module/DBIx::Class [4] https://metacpan.org/module/DBIx::Class::Candy https://metacpan.org/module/DBIx::Class::Candy [5] https://metacpan.org/module/Moose https://metacpan.org/module/Moose
- anonymous 14y agoPython and Ruby both have garbage collectors and can deal with reference cycles. Perl only has reference counting, leading to programs that leak memory due to reference cycles and needing to hunt down where in the code you're creating them. It's the only high-level language I know of that only has reference counting for memory management.
- lazyjones 14y ago> It's the only high-level language I know of that only has reference counting for memory management. It's also the only high-level language I know of that can't really be parsed ("only Perl can parse Perl" they say). It's a dead language really, you can also see this from the number of noisy evangelists vs. professional users nowdays (and that comes from someone who has used Perl almost exclusively for the past 10 years), if you couldn't see it from the diminishing quality of important modules on CPAN (e.g. I pulled my hair today over JSON::XS generating '-inf' from values on one side and crashing on the other side while trying to parse it). So, I'm learning Go now and improving my JS skills.
- jstanley 14y ago"you can also see this from the number of noisy evangelists vs. professional users nowadays" Actually, where I work, we use Perl almost exclusively. I don't know a single person who I would consider a "noisy evangelist" - we just quietly get stuff done.
- toddh 14y agoText processing with interpolation, the dynamic type system, and regular expressions is insanely easy as they are integrated directly into the language. You don't have a lot match, compile, and match group type scaffolding in your code.
- wiremine 14y ago> anybody has any arguments for using Perl instead of, let's say Python, these days? The Perl community is software's Maker subculture [1]. They have a "heck yeah, we'll give that a try" perspective lacking from other subcultures. The the larger software ecosystem ever lost this Maker/Perl worldview, it would be a huge lose. Taking a step back: In some ways, I think languages get larger adopted because of their culture. Their technical implementation is just a manifestation of the culture. (And, I think this explains why LISP has never broken out. It isn't a language problem, it's a cultural problem). [1] http://en.wikipedia.org/wiki/Maker_subculture http://en.wikipedia.org/wiki/Maker_subculture
- walshemj 14y agoCPAN is probably the main one when i built a front end to authority labs api all of the heavy lifting (apart from the Callback handler) was done using perl modules
- wschroed 14y agoTail recursion. ;) Bioinformatics. I am currently looking for a couple software developers (https://news.ycombinator.com/item?id=5203736 https://news.ycombinator.com/item?id=5203736) for positions where Perl is the dominantly used language.
- jrockway 14y agoCPAN.
- nnq 14y agodisclaimer: I really didn't intend to transform this into a discussion that's 70% about Python (I could have said Ruby or Javascript instead, the question was about Perl and the comparison was just an example). Right now I would downvote my own parent comment if I could, just to get higher the other comments that are actually relevant to Perl programmers.
- cpressey 14y agoMainly for the sake of completeness, I will mention: block scope. I program in Python a lot, and I like it, but it always boggles my mind when I remember that block "locals" are still visible after a block is closed. JS and PHP are (I believe) the same way about this. The Perl (and C) approach of "proper" block scope feels much less icky to me.