Hacker News new | past | comments | ask | show | jobs | submit login

perl one-liners are pretty powerful and can replace awk/sed/cut/tr/etc. That being said, then you have to remember which command-line options you should give perl (was it -lane to do X, or was it -pie, or something else entirely?).

But yeah, the perl rabbit hole goes as deep as you want to, and in some sense it makes it more difficult to say "screw it, I'm redoing this in a real language" as complexity rises. And then you end up with a thousand lines of line noise.




Well Perl is a real language, so of course it makes it more difficult to say “screw it, I'm redoing this in a real language”.

That said the Perl that you write in a one-liner should be different than the Perl that you write when the complexity rises.

If you have more than a few hundred lines, you probably need to move some of it out into a module. There should also be tests for that module. It might even make sense to structure it like a CPAN module so that you can use the existing tools to test and install it.


I have to admit the last time I wrote anything larger than short scripts in perl was in the perl 4 period (on HP-UX to boot). I eagerly awaited the perl 5 version of the Camel book, but in the end I jumped ship to python before getting seriously into perl 5.


I haven’t coded Perl beyond one-liners. What attracts me to it are its regular expressions. So much of Unix scripting seems to involve regexps. So I figure Perl+utilities is the better option compared to utilities+Bash.

I wouldn’t wanna use it for more than short scripts. Perl 6 might be fun, but it doesn’t seem to have a large enough community.


If you want to improve your coding skills you should read “Higher Order Perl”. (made available for free online by the author)

If you want to improve your Perl code read “Modern Perl”. (There is more than one version, and I know the first version was made freely available online)

Perl is a better language for large codebases than most people give it credit for. That said it allows more creativity when it comes to your code. So you can make awful code just as easily as beautiful code. Perl6 makes the beautiful code easier to write and shorter, while making awful code a bit harder to write.


> There is more than one version, and I know the first version was made freely available online

Good news! Every version is freely available online. Here's the most recent:

http://modernperlbooks.com/books/modern_perl_2016/index.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: