News for hackers. Stuff that matters.
Re:Problem solving with Unix commands by SomethingOrNot on Thursday February 14, 2019 @06:48AM (#19161184)
I’m not terribly experienced with Unix tools but I reckon that it might be best to just use Perl instead. Then you just have to worry about PCRE instead of PCRE in addition to old-style regexps.

Then again, Perl is even scarier.

Re:Problem solving with Unix commands by jabl on Thursday February 14, 2019 @07:56AM (#19161500)
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.

Re:Problem solving with Unix commands by b2gills on Monday February 18, 2019 @06:42PM (#19195530)
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.

Re:Problem solving with Unix commands by jabl on Thursday February 21, 2019 @02:57PM (#19220027)
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.
Re:Problem solving with Unix commands by SomethingOrNot on Thursday February 14, 2019 @08:05AM (#19161543)
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.

Re:Problem solving with Unix commands by b2gills on Monday February 18, 2019 @07:15PM (#19195693)
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.

Re:Problem solving with Unix commands by chromatic on Tuesday February 19, 2019 @04:55PM (#19203237)
> 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