Live data from Hacker News

Perl is 26 Today

modernperlbooks.com

141–150 of 194 posts

Re: Perl is 26 Today

#142
post #25

Earlier quoted context omitted.

"CGI Programming with Perl, 2nd Edition" is from the year 2000, otherwise I'd joke about 20th century called and want their library back. :-) If you can't go to the modern frameworks, I quite like Dancer myself, you can get an ebook from O'Reilly (or used).

whats so bad about CGI, even after FCGI?

The world has moved on, we've got more sane abstractions. PSGI[1][2] (modeled after WSGI) is basically CGI re-imagined and done better.

1: http://www.modernperlbooks.com/mt/2011/03/why-psgiplack-matt...

2: http://search.cpan.org/~miyagawa/PSGI-1.102/PSGI.pod

D'oh! Now I see below that your duplicate of this question got the love it deserved already...

Re: Perl is 26 Today

#143
post #97

Was 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…

Adding a bit of praise for "Programming Perl". (As well as for some of the other books by the fine people you've listed.) "Programming Perl" is not just (very) informative, it is also engagingly, even entertainingly informative. (Proof of this is left as an exercise for the reader... ;-)

Sadly, Programming Perl is a bad book for a newbie to read nowadays. http://perl-tutorial.org explains why and suggests newer alternatives. :)

Re: Perl is 26 Today

#144

I'm a relatively new programmer. Been programming for around 4 years. I tried Perl, but felt like the world had moved on, so I never really committed to it. With PHP, Python, Ruby and Javascript... space seems tight for another scripting language. Languages like Lua have something special. What's special about Perl? Edit: I don't want to be hateful. The more the merrier obviously.

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, "say" is there as of 5.10 if you know where to look for it, and you go out of your way to enable it:

    use feature 'say';
    say $x if $x > 5;
(2) In "modern", better practice, production-quality Perl you pretty much have to either hedge every comparison op with a check for defined-ness:

    use feature 'say';
    say $x if defined $x && $x > 5;
in order to head off an unsightly warning about $x not being initialized:

    Use of uninitialized value $x in numeric gt (>) at print-if.pl line 5.
or add even more boilerplate to suppress the warning:

    use feature 'say';
    {
        no warnings 'uninitialized';
        print $x if $x > 5;
    }
or be very attentive about how $x can mutate once it's gotten passed whatever validations you're imposing on it before it enters your scope -- via e.g. Params::Validate, Method::Signatures, provided you know these tools exist and are up to speed and hip as to how to use them effectively.

(Yes, I know that in some contexts, the warning on 'uninitialized' can be very useful. But my point is, most of the time, and especially for novices, it's more of a misfeature).

(3) We shouldn't gloss over the fact that the magical pseudo-grammatical construction the "infix" if syntax provides is itself problematic in many ways.

In the current example, it simply isn't clear -- until you've become very comfortable with the language! -- if the original statement

    say $x if $x > 5;
is or is not equivalent to the very similar construction

    $foo = $x if $x > 5;
    say $foo
This is because it is by no means obvious as to which of the more "active" parts of the original expression -- either the "verb" (print) or the conditional (if) -- takes precedence.

And unfortunately, it's not only possible, but terribly easy to "whip up" fare more volatile constructions like this in Perl 5. Various on this theme -- gotchas about print, conditionals, and complex "if/unless" constructions -- were of course given ample treatment in Perl Better Practices, to the point where (I believe) that Damian pretty much eschews "trailing" if/unless constructions altogether.

(4) Lastly, it's sad to say that for all the complains of Python having too many safety belts and what not, it completely nails the hidden complexity management issues embedded in such a simple construct like Perl's "print-if" idiom.

In Python, basically the only sensible way to achieve the original desired result is to do this:

    if x > 5:
        print x
Perfectly clear, completely unambiguous, and basically impossible to screw up.

Re: Perl is 26 Today

#145

Earlier quoted context omitted.

Sorry for being petty, but what's this creeping pattern of folk leading with "So"? It reads poorly and sounds even worse.

Here's more information on the linguistic development of starting sentences with 'So': http://chronicle.com/blogs/linguafranca/2011/12/02/so-it-tur...

Good links. Thanks.

(Predictably the Chronicle article has a bunch of comedy geniuses using it as a comment!)

Re: Perl is 26 Today

#146

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.)

Re: Perl is 26 Today

#147

Earlier quoted context omitted.

It is a reasonable question. I tend to write like I talk, which the Chicago manual of style frowns upon. It isn't a particularly 'creeping' pattern, it is quite common amongst people with whom I have regular informal conversations. That said[1], I probably feel the same way about the use of 'because' in informal speech. Which was recently upgraded to include the form "because ." I don't find that a particularly compe…

There was a recent album release called "Because the internet". Absolutely horrific :-) --- I think what gets me about leading with "So" (more so in spoken converstaion) is that it makes the speaker sound like they're constantly, and consciously, having to reframe things in a form that the poor dummy they're speaking to will understand. Politicians do it a lot when answering questions. I also recognise that it's more…

I can see that aspect of it, I typically use it as an equivalent to "In my experience ..." or to convey a result that is derived empirically rather than reasoned do by first principles. I consider such things more 'as a personal preference' rather than having any sort of definitive reasoning behind them.

Re: Perl is 26 Today

#148

So 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 help either: http://www.jeffreykegler.com/Home/perl-and-undecidability

Re: Perl is 26 Today

#149
post #58
post #26

Earlier quoted context omitted.

You really prefer Python threading to anything?! You haven't found any of the major Perl web frameworks? You haven't seen Moose for OO? perlbrew? (Don't get me started on list comprehension, extra stuff to learn because Python lack real maps with real lambdas.) And so on... Do you always have opinions on stuff you have no clue about?! Start with getting the Modern Perl book and read it (free pdf). Ask (/search) on Pe…

> 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 user-space and OS threads...)

Re: Perl is 26 Today

#150

Earlier quoted context omitted.

perl is more connected to things flowing through it. In python I was often fighting with the subprocess module to get things plumbed but in perl it was trivial to open a process to a pipe and then put a process on the output of that pipe. Much of the code I've written here does analysis for bad actors (robots and such) and perls regular expressions have been easier to get right sooner. (although the naming of results…

> although the naming of results in Python is quite useful I assume you mean named captures? C:\>perl -E "'abc1234asf' =~ /(? \d+)/; say $+{one};" 1234 > template toolkit Please try Text::Xslate. :)

I will look at Xslate. My simple system basically combined a markdown (with some enhancements) "base" document, with custom image tags and source tags. The current source to HTML mechanism used vim to do the syntax coloring, then dump out the html with ToHTML and then processed by the perl code to pull out the actual code. Given that I've been moving code over to github my plan for the future is just to pull gists into the HTML pages.

To the extent that I can simplify steps with Xslate we'll see. It still takes too long to go from 'thought' to 'page' (and my 'schematic description' -> SVG (or PNG) schematic work is still incomplete)

Post reply on HN