10 ms·
How familiar are you with Perl, and how much have you used it? Most of the anti-Perl comments I've heard have been from people who really didn't know it very w
by pmoriarty 7y ago
How familiar are you with Perl, and how much have you used it?
Most of the anti-Perl comments I've heard have been from people who really didn't know it very well, if at all.
Some of them might have glanced at some Perl code and saw a dense regex and dismissed it as "line noise". Well, yeah, if you don't know regexes you would be forgiven for thinking it was line noise, but if you did know regexes it should look no more like line noise than a similarly dense regex in any other language.
For a long time now, Perl has allowed regexes to be commented. Commenting dense regexes and splitting them up in to short regexes assigned to judiciously named variables is just good style in any language, and has been the norm in Perl for a long time. Furthermore, modern Perl style guidelines advise code to be written with verbose, English words instead of ancient Perl one-character special variable names.
So setting aside both dense, uncommented regexes and ancient single-letter special variable names, both of which have been recognized as poor style in Perl for decades now, I'm really not sure what the complaints about Perl readability are about. To me it looks really no uglier than any other mainstream language, and one could easily make the argument that any other mainstream language you care to name is uglier in some of its own ways.
If you include non-mainstream languages, some languages which have a lot of fans here on HN are arguably a lot less readable than Perl to someone only familiar with traditional Algol-style languages. In particular, I'm thinking of Forth and Haskell. Yet you rarely hear complaints on here about their readability.
- lilSebastian 7y ago> Most of the anti-Perl comments I've heard have been from people who really didn't know it very well, if at all. Indeed, I hope this thread gets picked up by http://n-gate.com/ http://n-gate.com/
- AlexCoventry 7y agoYou are violating the prime directive. http://n-gate.com/hackernews/2017/08/22/0/ http://n-gate.com/hackernews/2017/08/22/0/
- j9461701 7y ago>How familiar are you with Perl, and how much have you used it? It's what my company's entire code base is written in. So every hour of every work day for the past 6 months. >To me it looks really no uglier than any other mainstream language, and one could easily make the argument that any other mainstream language you care to name is uglier in some of its own ways. It's no one thing, but a bunch of little things that compound on top of each other. Until you get something like this: while (<>) { ($h{$_}++ == 1) && push (@outputarray, $_); }; Mostly though it's how it's used. It can technically do anything, so a lot of the times it is asked to do everything. Until one day you wake up to find you have hundreds of perl files, all tens of thousands of lines long, that all interconnect in an insane Object Oriented hierarchy soup stretching across every conceivable programming space - from database control to money processing to security to web site design.
- wumpus 7y agoHuh, I worked at a company that wrote 1.5 million lines of perl together, and we never ended up with those problems. Maybe you picked the wrong co-workers? You can screw up in any language.
- hpcjoe 7y agoYeah ... most of my 2-company-ago's software stack was written in Perl. Worked very well. The specific example cited while(<>){ $h{$_}++ && ... } is quite understandable to anyone who has used Perl for more than a few weeks. Its a common pattern. Complaining about this, which is, for the uninitiated, looping over reading each line from STDIN until EOF, incrementing a hash variable indexed by each line, etc. This is a very common pattern in perl. Draw your own conclusion as to whether complaining about idiomatic language from a "skilled practitioner" is something one should take without a grain or two of salt. And of course, being Perl, there are many ... many ... ways to accomplish the same task. Leveraging CPAN modules. I'd leave discovering some of the as an exercise for the reader.
- weare138 7y agoI have a decent amount of experience with Perl 5 and one of Perl's greatest features is also sometimes it's greatest liability, versatility. It's permissiveness tends to facilitate poor coding styles and methods which is why there's alot of bad Perl out there. Plus Perl 5 is just different for lack of a better term. If your proficient newer languages, Perl 5 and the Perl way of doing things probably seems a little strange.
- deleted 7y ago[deleted]
- commandersaki 7y ago'x' is an operator...