News for hackers. Stuff that matters.
Re:Python for Perl programmers by ajross on Tuesday April 03, 2012 @05:12PM (#3794849)
Or just:

  my $data = `cat $file`;
Some folks dislike the useful use of cat, but anyone who's ever read a shell script will recognize the idiom. And it's a trivial one-liner much simpler still than the python code .
Re:Python for Perl programmers by pdehaan on Tuesday April 03, 2012 @06:46PM (#3795193)
This isn't exactly idiomatic Perl and fails completely in environments that don't have cat (Windows).

For one-time uses there's not a problem. However, if you find yourself writing what amount to shell scripts in Perl, you might be better off just writing shell scripts.

Re:Python for Perl programmers by ajross on Tuesday April 03, 2012 @06:53PM (#3795214)
Excuse me? Who are you to determine what is and isn't "idiomatic"? And that you would try this kind of thing about perl of all languages is just shocking. What's saddest is that it's the lack of this kind of absurdist pursuit of robustness and purity is one of the things that has always best defined the perl community.

Broadly, your argument seems to be that spawning processes in the external environment[1] (which, admittedly, is inherently nonportable) is a Bad Thing in perl, and that we shouldn't do it. When I rephrase it like that, does it sound as poo-flinging crazy to you as it does to me?

[1] Let's be honest: a working "cat" is pretty much the single most portable thing you can put between the backticks. If you won't allow this, what will you permit?

Re:Python for Perl programmers by pdehaan on Tuesday April 03, 2012 @08:33PM (#3795570)
First off, apologies if I was coming off as rude, I wasn't trying to be.

My point was more that slurping a file without spawning another process is already quite easy in perl. That method of slurping contradicts common patterns like "while (<$fh>)". I'm not saying it's strictly wrong or even bad, just not necassarily the best option.