4 ms·
As much as I love Unix I am terrible at Perl. Anyone know any good resources for learning Perl 5? I seem to stumble quite a bit with CPAN in comparison to pip
by 4oo4 4y ago
As much as I love Unix I am terrible at Perl. Anyone know any good resources for learning Perl 5?
I seem to stumble quite a bit with CPAN in comparison to pip or npm. Correct me if I'm wrong, but I think that's because it's not a true package manager like those, and more of just a module downloader that's not as stateful?
CPAN pains I think are a huge reason why I haven't learned it better, also I think Perl can vary quite a bit with readability compared with other languages.
You can write nice looking Perl like those examples but I've also seen things with extremely dense and terse syntax that I can't even begin to walk through. To take an extreme example, RSA in 3 lines of Perl. I have always been curious how that is actual working code.
- forgotmypw17 4y agoI don't use CPAN. If I need something I don't want to write myself, I use the command line. To use RSA as an example, instead of trying to use a PGP module from CPAN, I use the gpg command-line program, write its output to a file, and use that. It's not as graceful, but it is also highly compatible with just OS packages.
- 4oo4 4y agoI bet you get better performance that way too. That kinda confirms my suspicions that Perl modules are awful to work with, though I'll admit I'm an idiot about the Perl ecosystem so there may be better module tools I don't know about. What makes you choose Perl over bash/sh then, if it's working as a "glue" between actual binaries? I imagine the text processing things it excels at?
- macintux 4y agoNot the person you’re responding to, but for me any time I have to perform any branching logic in a shell script I start reaching for Python or Perl.
- forgotmypw17 4y agoI would choose bash, but the syntax is just too awkward for me. I feel comfortable with parentheses, curly braces, freeform whitespace, etc., if/else, do/while, foreach, etc., and that's how I write my Perl. I sometimes call it "PHP style Perl", because most of the code i write can be copied and pasted almost verbatim between PHP and Perl, and I use this to my advantage. I don't use PHP a lot, but I do find it one of the most convenient ways to duct-tape things to a web server. On the whole, I've settled on a strategy of writing most code in such a way that it could have been written (with perfect foresight of the future) 20 years and go and have worked the whole time. I think of it as exploiting the Lindy Effect to my advantage. :)
- tyingq 4y agoThere's cpanminus...it's pretty popular: https://metacpan.org/dist/App-cpanminus/view/bin/cpanm https://metacpan.org/dist/App-cpanminus/view/bin/cpanm It downloads dependencies automatically and does a reasonable job with --uninstall, which is probably your main complaints.
- senorsmile 4y agoO'Reilly's "Learning Perl" is definitely the best way to get from zero to intermediate imho.
- senorsmile 4y agoFor cpan stuff, carton works perfectly for me (it's like bundler for Perl). I also prefer plenv for specifying the specific and most up to date version of Perl.