My favorite perl story: Had been working on parsing through huge flat text files with it, had over 40 lines going and just could not get it to work correctly. I took a step back, rethought what I was trying to do, and wrote a one liner awk that just worked. Side note: I have noticed that in bioinformatics, perl is largely being replaced with python in tool usage.
> I have noticed that in bioinformatics, perl is largely being replaced with python in tool usage. Which has honestly little to do with the language and more with the fact that the bioinformatics-related Perl books are the worst programming teaching books i have ever seen. (Honestly, a lot of the flak on perl goes back to old and outdated books.)
Perl is 26 Today
181–190 of 194 posts
Re: Perl is 26 Today
#182Earlier quoted context omitted.
You mean this, from the perlsyn man page? Statement Modifiers Any simple statement may optionally be followed by a SINGLE modifier, just before the terminating semicolon (or block ending). The possible modifiers are: if EXPR unless EXPR while EXPR until EXPR when EXPR for LIST foreach LIST There are rules for how loosely and tightly different operators bind. Read the docs, and your questions will be answered. Ignorin…
The point is that in any well designed product you shouldn't have to study the docs (all that much) in order to start being productive. And there should be as few "gotchas" as humanely possible please. Did I say pretty please? This has been observed with countless other technologies -- JavaScript, MySQL, MongoDB, etc. Long-time Perl hackers tend to forget their first experiences with the languages (which for many wit…
The point is that in any well designed product you shouldn't have to study the docs (all that much) in order to start being productive
And I don't think you need to in order to assume the correct functioning of
print $x if $x;
As much as you may find it compelling to point towards it's possible interpretation as print( $x if $x );
I find that interpretation nonsensical, and anyone making any effort to learn how the language works or if not that, at least think about what it could mean and what it probably means will not be surprised. Perl tries to Do The Right Thing (DTRT) whenever possible, and with this principle in play, I think the meaning of this statement is very obvious.Even if we extend the statement to be somewhat more ambiguous, a bit of thinking about the problem makes it obvious what the right thing to do is, and it is indeed what Perl does:
print $x, $y if $x;
# OR
print $x, $y if $y
You can either interpret that as Perl does, or as: print( ($x), ($y if $x) );
# OR
print( ($x), ($y if $y) );
Do you ever really want something like that? Is that useful to you, given that there are a few other ways of achieving that which are much less cumbersome ($y||$y)?The point is that in any well designed product you shouldn't have to study the docs (all that much) in order to start being productive. And there should be as few "gotchas" as humanely possible please. Did I say pretty please?
It's almost comical that you are making this argument. One of Perl's strong points is that it's really easy for someone to pick up and start using, because it tries to DTRT, making it very easy for the beginner.
Long-time Perl hackers tend to forget their first experiences with the languages (which for many with languages with far worse track records on the consistency / simplicity scale). But newer users have (rightfully) come to expect much better.
When I mention Perl, I still hear people immediately jump out with "Oh, I remember I used Perl back in the day and it was real easy to whip up a little program to do what I wanted."
I think what you are running into is that you have experience and expectations with other languages, and when Perl doesn't match those expectations, you blame Perl, rather than meeting it at it's own level. I suspect you don't do this as much with languages that appear radically different, such as Haskell and Lisp. If so, is that Perl's fault for following a different path, or yours for failing to use it appropriately?
Re: Perl is 26 Today
#183Perl is the ultimate hacker's language. It was for the 90s and 00s what Microsoft BASIC was to the 1980s. However, I think it's also coming back. Most of the "inefficiencies" it got tagged with were relics of the server model at the time, like CGI. Now many are seeing that mastery of a general-purpose language is better than knowledge of specialized methods in a specialized language. The first is flexible; the latter…
I also think that things like Modern Perl[1] are helping to move the community away from the "line-noise" style of Perl that it was (in)famous for back in the day. 1: http://modernperlbooks.com
Re: Perl is 26 Today
#184Earlier quoted context omitted.
I first looked at perl last week and also shared your sentiment. At first when I saw perl I was aghast. The "ugly" $%@ syntax seemed pointless and unreadable. Then I decided to take a look at a non-beginner book, Intermediate Perl http://it-ebooks.info/book/879/ . I was surprised and excited 50 pages in because I realized that Perl had a wealth of tricks , and that that "ugly" $%@ syntax actually had some cool reperc…
Unfortunately -- and this is one of the many "banana peels" in Perl 5 -- even a simple statement like print x if x > 5 is problematic in p5 for a whole bunch of reasons: (1) At a bare minimum, what you really need to say is: print "$x\n" if $x > 5; That extra "\n" is a definite turn-off to a lot of people when the get their very first look at Perl. Really, the default these days should be more "say"-like. Of course,…
Re: Perl is 26 Today
#185So when I went to Google I learned Python. I enjoyed the language and used it a lot, it has a solid support base and pretty much anything you wanted to do you could import a module to do it. When I went to Blekko they were a perl shop, which was a bit intimidating at first, but after programming in it for nearly 4 years now I find I can get from concept to first test faster in Perl than I could in Python. And I hadn'…
I can't stand perl's philosophy: http://en.wikipedia.org/wiki/There%27s_more_than_one_way_to_... Contrast with Python's philosophy: https://wiki.python.org/moin/TOOWTDI Python's philosophy may be limiting for some people, but I'd rather have code that I have a decent chance of reading and understanding the run-time behavior of than a language that encourages extreme personalization. The whole parsing thing doesn't he…
And secondly its extremely rare that you will run into some obscure feature which indulges in the whole parsing thing you mentioned.
Re: Perl is 26 Today
#186Earlier quoted context omitted.
>>> I was hoping to get you to be creative and come up with your own problem/solution pairs. >> You wanted me to come up with a scenario like gaming graphics pipelines in a discussion of Perl, a language primarily used for Unix scripting tasks? > I just told you that i exactly did not want you do to that: "I was hoping to get you to be creative and come up with your own problem/solution pairs." Christ.
I'm sorry, i don't know what's upsetting you. What i said originally and how you interpreted it are simply entirely different things.
Re: Perl is 26 Today
#187Re: Perl is 26 Today
#188Earlier quoted context omitted.
> You really prefer Python threading to anything?! The Python 'process' and 'queue' modules rock (yes, multiple single threaded processes still counts as multithreading). I've had apps on the front page of HN / Smashing Mag using them, happily taking advantage of a multicore server. I swear half the people who bitch about the GIL have never used either of these modules (not you, people in general).
Using multiple single-threaded processes still counts as parallelism, sure, but please don't set a precedent for using the term "multithreading" to mean something other than "using multiple threads". Nobody who works professionally on these sorts of problems would understand "multithreading" in the way that you're using it. (The term is overloaded enough as it is, given that it glosses over the distinction between us…
Re: Perl is 26 Today
#189Was introduced to Perl in a programming languages course in college in 1996/1997. Brought it to my first job, where it gained fame there for being the language that took a 12 hour process and ran it in less than a minute. (They had originally been trying to parse a huge log file with Visual Basic, I believe it was. Perl was made for, well, extraction and reporting...) Been programming in it full time ever since. Than…
One of my favorite Perl books, albeit a bit lesser-known is "Higher Order Perl" by Mark Jason Dominus.
Re: Perl is 26 Today
#190Earlier quoted context omitted.
> I think it may remain a decent example of how to write one. No contest. I'm just worried that, with many people mentioning the "good old books" (which by now are simply bad), without mentioning the current good ones, more newbies will try to get those old books and learn from them and get themselves and others in a lot of trouble that way. That's why i comment to explain and point out alternatives.
Well, that's a fair point. I think I ended up with a (legitimate) ebook of the 4th edition, but I haven't tried it. Newcomers should understand that Perl is beget of its *NIX heritage. With some understanding of this, it stops being "line noise". Perl was the language I encountered that "thought the way I do". For those considering, I think this remains a very relevant factor in its continued existence. For what that…
"Intermediate Perl" is still awesome for the next level stuff, particularly with all the references and transformations, et. al.