LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Is it still worth learning Perl ? (https://www.linuxquestions.org/questions/programming-9/is-it-still-worth-learning-perl-4175707212/)

ychaouche 01-31-2022 02:10 AM

Is it still worth learning Perl ?
 
I don't really care if it's getting me a job or not, I'm thinking about
perl as a practical tool to help me get jobs done. What do you guys
think of perl and what is your typical usage of it ? like, when you
have a thing to do, what is your criteria for choosing perl over, say,
bash, awk, grep, sed and similiar tools ?

pan64 01-31-2022 02:21 AM

perl knows all of bash, awk, grep and sed (and even more) together. Actually you can do everything with perl, like database access, web server, package management or the nowadays fashionable microservices (amongst other things), just perl itself is out of fashion. So probably better to learn python or java.
The most important feature of perl is the regex which is extremely powerful and used everywhere. It is definitely worth learning those perl regular expressions.

syg00 01-31-2022 02:55 AM

Down the rabbit hole you go ...

It is not a quick "pick-up-and-run-with-it" scenario although you can pick up the bits you need fairly quickly. But you need to know what you need to know ... :scratch:
And of course there is the small matter of which perl.

To be honest as a now apparently unemployable has-been, I find my need for perl diminishing toward zero these days. YMMV.

ychaouche 01-31-2022 03:05 AM

Quote:

Originally Posted by syg00 (Post 6323683)
And of course there is the small matter of which perl.

Exactly. It seems Perl 6 has to be seen as a different (new) programming language,
claimed[1] to be one (or many) generations ahead of the competition (including java,
nodejs, swift).

[1] https://genius.it/25017618/developer...ith-larry-wall

ychaouche 01-31-2022 03:46 AM

In fact, Perl 6 has been renamed to Raku ! (try http://perl6.org)

syg00 01-31-2022 03:52 AM

It has been called many things since its protracted gestation.

GazL 01-31-2022 03:53 AM

If you've written, or are intending to write a bash script that needs to make heavy use of sed/awk or where whitespace or escaping characters becomes an issue then perl5 is probably a better choice.

IMO its niche is in writing small/efficient programs that achieve surprisingly much with a surprising small amount of code: hence why perl5 one liners are such a thing.

When using it for small tasks you don't really need to go into that much depth with it, so yes, it's still worth learning the basics, just don't get carried away and try and use it for stuff that it's really not suited for.

It's a useful tool for a sysadm to have in his toolkit, but as others have said, it's very much out of fashion these days.

Turbocapitalist 01-31-2022 04:38 AM

Quote:

Originally Posted by pan64 (Post 6323679)
The most important feature of perl is the regex which is extremely powerful and used everywhere. It is definitely worth learning those perl regular expressions.

I got by without sed or awk for years because perl is a superset of those capabilities. If you are doing heavy pattern matching or processing text, then it is unequaled.

ychaouche 01-31-2022 07:26 AM

Quote:

It’s funny, fifteen years ago everyone was saying how Perl was shooting itself in the foot with a massive language redesign, because the world was clearly going to switch to Python and Ruby. Well everyone did switch to Python and Ruby, but now everyone’s got the itch to switch again because it turns out Python and Ruby weren’t designed for concurrent code execution. Maybe shooting yourself in the foot isn’t such a bad strategy, if what you need are bionic robo-feet.
-- Evan Miller[1]

[1] https://genius.it/25018586/www.evanm...ng-perl-6.html

scasey 01-31-2022 08:21 AM

I find perl to be my go-to language for any major project. I’ve used it for elaborate, complex data collection and analysis, compilation, formatting and output of the collected data. Got started with an application that collected data about job opportunities, storing it in a “flat file” (‘cause we didn’t know if a database was available), and displaying it on a website.
Since, I mostly use databases, which is not difficult in perl. I use it for “web-based applications”.

I use sed pretty much only for one-offs, and I’ve never got around to learning awk at all…never mind java or python (tab formatting? Really? Shades of AS400…)

As has been said, grokking perl regex is essential. It is a rabbit hole, but I like it down here. :)

TB0ne 01-31-2022 08:24 AM

Quote:

Originally Posted by scasey (Post 6323750)
I find perl to be my go-to language for any major project. I’ve used it for elaborate, complex data collection and analysis, compilation, formatting and output of the collected data. Got started with an application that collected data about job opportunities, storing it in a “flat file” (‘cause we didn’t know if a database was available), and displaying it on a website. Since, I mostly use databases, which is not difficult in perl. I use it for “web-based applications”.

I use sed pretty much only for one-offs, and I’ve never got around to learning awk at all…never mind java or python (tab formatting? Really? Shades of AS400…)

As has been said, grokking perl regex is essential. It is a rabbit hole, but I like it down here. :)

I'm with you, scasey and Turbocapitalist. It's usually my go-to as well, since it can process files much more quickly than anything else I've used, and DB access is robust as well. Python is handy, too, but perl is more useful (no matter if it's perl or raku. :) )

fatmac 01-31-2022 10:24 AM

I was going to teach myself after retiring, bought the books, then seemed to lose interest; other things took up my time, but if serious, I'll suggest the Perl Mongers forum, they like to encourage newbies, I found, & they have lots of info.

https://www.perlmonks.org/?node_id=739026

wpeckham 01-31-2022 10:54 AM

If you seriously want to use Perl (and I find it my most useful tool after bash) then study Perl-5. Perl-6 is not a language, it is a language standard. Implementations come with different names and degrees of implementation of the standard, but Perl-5 is a very real, and powerful, engine. Learning is never wasted!

Perl one-liners is almost a different animal, and commands that can solve problems with a single line of code on the command line can serve you well in many environments. Plus, they are fun!

chrism01 01-31-2022 09:45 PM

I've used Perl5 for almost all the things mentioned above by others at different times.
Since you say you're not bothered about it getting you a job, I'd say go for it!
It's a lot of fun and very powerful and flexible.

As above, the gurus live over at perlmonks.org.
Docs at https://perldoc.perl.org/ . One of the great things about the docs is the amount of examples used to illustrate every cmd; the opposite of (most) *nix man pages ;)
See also https://learn.perl.org/tutorials/.
I highly recommend the Learning Perl book (aka Llama book) and the Perl Cookbook .

pan64 02-01-2022 01:05 AM

I liked and enjoyed perl very much (yes, that was in the previous century). It is really powerful and flexible and efficient and .... No doubt.
An additional link: www.cpan.org which contains the available perl modules (you may try to compare it to python/java modules).
And an additional thought: apt, apt-get and the whole package management system was written in pure perl, but now you can find "extensions" written in python. What a mess!


All times are GMT -5. The time now is 04:13 PM.