fidodido has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I'm planning to learn a scripting language for automation. Perl has been a default choice in this scenario, but with other languages coming up, how's Perl doing? I wanna automate some stuff in my current job,start with simple automation, then may be move on to excel reports with graphs (The management here is big time into it. They just like everything "graphisized" :). I'll then use that experience to sort of "break" into automation focused jobs. So how's Perl demand in automation?

I know this is like walking into a Harley Davidson showroom and asking folks which is a better thing, a cruiser or a sports bike (or vice versa)? But hope you guys would be able to give me some clarity.

Another reason for asking here, is, there's a lot of articles on the net that seem to indicate that Perl is on it's way out....and then there's an article about Perl 7 (and many more on Perl 6).

Which brings me to the next question. I'm planning to start with Perl 5, and then may be move to Perl 6. Perl 5 seems to be default installed on the linux servers here, and then there's some Windows friendly version installed on some other servers.

That's one too many questions, but hope you folks would clear it up for me.

Replies are listed 'Best First'.
Re: How is Perl for automation?
by hippo (Chancellor) on Dec 02, 2020 at 19:39 UTC
    ....and then there's an article about Perl 7 (and many more on Perl 6)

    Let's put that to bed. "Perl 6" no longer exists. It was a different language entirely and not, as the name would obviously suggest, a version of Perl. After almost 2 decades of this confusion it was finally renamed last year. The new name for that language is "raku".

    Perl 7 is not yet released. It is (intended to be) a version of Perl - much the same as Perl 5 but perhaps with different defaults.

    Regarding automation, I can't honestly think of a better language for that than Perl. It has the tools, the ubiquity and the thousands of relevant modules in CPAN. Have a go - you won't look back.


    🦛

Re: How is Perl for automation?
by GrandFather (Saint) on Dec 02, 2020 at 19:57 UTC

    Perl is excellent for automation. The biggest automation task I took on was a bespoke build and test system that ran on multiple version of Windows and Mac OS. In its first form it rebuilt all our applications, add ons and tools overnight then ran regression and until tests against everything using a distributed database of task queues and a "Releases" file server that used a small configuration file to describe each build or test task. Later I added support for continuous integration with almost no change to the overall system.

    On the very small scale I use Perl to take the contents of an email newsletter and reformat it for use on a web page with page links for the sections in the newsletter, email addresses appropriately wrapped, tabulated data in tables, ... .

    Perl has great cross platform support and a lot of system support built in. CPAN is a vast resource with a lot of excellent and widely used (and yes, some rubbish) modules covering almost anything you need to support automating stuff.

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
Re: How is Perl for automation?
by Bod (Chaplain) on Dec 02, 2020 at 21:13 UTC

    Perl is excellent at dealing with Excel spreadsheets. I have a number of automation tools on Windows which run under Windows Task Scheduler and extract data from one or more spreadsheet. One is a GUI application that interfaces with Xero to help with our company's accounting.

    Much of the power of Perl is CPAN which is a rich repository for Perl modules written by the Perl community. As Perl has been around for a long time, so there are a lot of very stable modules available to you. For example, to handle spreadsheets I use Spreadsheet::Read to work with spreadsheets and GD::Graph for producing real time graphs in a variety of formats.

    The other advantage of a mature language is the support that is available as I am sure you have already discovered here in the Monastery.

      Hi

      Amazing modules available on CPAN for Perl!!. Thank you!!

Re: How is Perl for automation?
by Tux (Canon) on Dec 04, 2020 at 13:32 UTC

    Most advices already passed should get you on your way, but I'd like to add one thing, as you explicitely mention Excel.

    As I am confronted with an increasing customer demand of results being presented in Excel, I have found that generating the Excel should be the final step.

    Don't see Excel as your (main) source for data manipulation. Read input from many sources (Excel, LibreOffice, CSV, JSON, YAML, XML, MS-SQL databases, PostgreSQL databases, Oracle databases, whatever ...) then use your business logic in perl, optionally store intermediate results in a local database like PostgreSQL or SQLite so small fixes can be done quickly without parsing/fetching all the sources again, and then generate the required output. Another big advantage of storing your work data in a local database is that the generation of the required outpout is much easier to test/change.

    If Excel is requested, I prefer to export every sheet in CSV, and then use the tools available in Text::CSV_XS' examples, like csv2xlsx to convert and merge the data into an Excel file.


    Enjoy, Have FUN! H.Merijn

      Very important point. Keep in mind that spreadsheets are widely seen as risky by auditors and their ilk. At $work (large US bank) we've had a big initiative put in place to catalogue and manage the inventory of spreadsheets used because of the inherent risks. You can't (as easily) put the logic in a spreadsheet under SCM or subject it to a test suite like you can perl (or python, or R, or ...) which generates the underlying CSV that's displayed.

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

        Hi,

        1) Thank you for making me aware of the risk issue. Another monk also offered solid advice on how to NOT use excel as source of data. You are all genuinely helpful folks.

        2) So, you are saying that Perl is used in a big bank? Even now? That is good!!

      Some coincidence this!! I was actually thinking of using Excel as source and write the data to another excel file which would have about 20 worksheets...Had it not been for your advice, I would not have known.

      I'm still far away from that level of scripting, but the guidance you have provided is worth it's weight in gold. Thank you.

Re: How is Perl for automation?
by fidodido (Sexton) on Dec 04, 2020 at 12:43 UTC

    Hi Monks,

    Thank you all for the answers. Best part is, you guys kept it logical and no one felt offended when I asked job related questions or the perceived negative notions about Perl that I mentioned in my second question. It was all directly answered with straight up answers. Sign of true professionals. Hats off to you all.

    Looks like I can now give points to answers. I've already exhausted my points today, but I will continue when I accrue more points.

      Perhaps you could be more specific about what processes/applications you're interested in automating. Regarding Excel, you can automate various spreadsheet packages that can save data in excel format, alternatively you can use perl directly to create/manipulate spreadsheets. Most people are asking for work related help, so don't worry about that.

        I will most certainly start posting questions here, but first, I'd like to write something and then post code here if I get stuck. Desperate times may require me to ask for guidance from the scratch, but I will most certainly try to avoid that.

        By the way, I've installed Perl on my laptop (windows 10) and started playing with it. Must say I like it so far...

        Based on the answers given here and reviews, I've focused on two books - Learning Perl 7th Edition and Beginning Perl (Ovid Poe). While there is a latest version of Beginning Perl available, the one written by Ovid seems to have some really good reviews on Amazon. I am aware that it was released a few years ago, but judging the table of contents + reviews, I'm sure there will be a lot I can learn from both the books.

Re: How is Perl for automation?
by karlgoethebier (Abbot) on Dec 02, 2020 at 20:19 UTC
    «...automation?»

    Good.

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Re: How is Perl for automation?
by karlgoethebier (Abbot) on Dec 03, 2020 at 18:53 UTC

    A real life automation example probably still in use as Pentaho didn’t get much better over the years. Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Re: How is Perl for automation?
by fidodido (Sexton) on Dec 02, 2020 at 20:30 UTC

    Hi,

    Thanks for the answers guys. But if I may ask, what about the job prospects? Is Perl viewed as not such a positive skill anymore? Pardon the bluntness but I'm a Tech Consultant of 40+ trying to add a scripting language to my skillset and I can really only learn 1 scripting language as of now, what with rest of my time divided between family, job and other technologies to study. From what the internet seems to tellnme, Perl is not that in demand, but that could be a good reason to focus on it, cause may be there's lot more python or ruby folks there than Perl. Sorry if I've ruffled some feathers, but just wanted to know.

    Also, any book you could suggest? Or something on Udemy?

      For most purposes individual languages are less important than experience. Most competent programmers can pick up and be productive in a language they haven't previously used fairly quickly. So in a way it doesn't matter if it is Perl, Python, Ruby or a slew of other languages. As a practical thing you are likely to get much better support learning Perl here than learning any other language anywhere else, and in the long run that may be the most important criteria for picking your next language.

      Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

        Judging by the speed and quality of answers I see here, I fully agree. Thank you Sir.

      From what the internet seems to tellnme, Perl is not that in demand

      You must be on some other internet. Mine says this.

      Also, any book you could suggest?

      Loads here - take your pick! Perhaps Automating System Administration With Perl might be a good option, once you have picked up the basics.


      🦛

        Man....that's some eye opener. Thanks.

        Sorry for the multi posting but, I had to say this....so if Im to believe the graph, then Perl being "dead" or "not in demand" or "disliked" is just FUD. Thanks again.

      Re Job prospects and comparing Perl to other languages, I keep a list of similar nodes here (see especially the "Recent Nodes (2020)" section at the end).

      what about the job prospects?

      I cannot give you a direct answer as I left employment over 15 years ago and have worked for myself ever since - I am now unemployable and that's the way it will stay...

      What I would say is that Perl is so much more than just a scripting language. It is very capable at scripting but can be used to create standalone Windows applications with the TK modules or distributed client/server systems and everything in between. Learning Perl opens up many, many possibilities and makes learning other languages easier in future.

      Perhaps a jobs site might give you an indication of the demand...

Re: How is Perl for automation?
by perlfan (Vicar) on Dec 03, 2020 at 18:06 UTC
    Perl 5/7 (6 is now called 'raku' and is a different language) will make you a literal ninja. Anything you read about perl dying (or BSD, etc) is FUD and should be completely ignored. They are lying to you because they do not want you to have the power of a ninja, which is everyone's birth right. Best part is it helps you learn everything else, never hinders. Can't say the same about other technologies or frameworks. So you are here and that's an amazing start and I tell you nothing but the truth.

      "Perl 5/7 (6 is now called 'raku' and is a different language) will make you a literal ninja. Anything you read about perl dying (or BSD, etc) is FUD and should be completely ignored. They are lying to you because they do not want you to have the power of a ninja, which is everyone's birth right."

      "I tell you nothing but the truth."

      At best this is all an embellishment. A literal Ninja is from Feudal Japan. Regarding the Ninja chat this is all demonstrably false. IMHO chat like this isn't helpful to anyone, and doesn't address the question at all, or attempt to draw any further information from OP to prove how Perl addresses any requirements. In and of itself Perl 5 doesn't "make" anyone anything. There's vast history here of people claiming to be experts never mind beginners who know nothing of perl, while understanding nothing of computing or problem solving at all.

        There's vast history here of people claiming to be experts never mind beginners who know nothing of perl, while understanding nothing of computing or problem solving at all

        By virtue of being here, they have demonstrated some ability to problem solve...

        >> Perl 5/7 (6 is now called 'raku' and is a different language) will make you a literal ninja.

        > At best this is all an embellishment. A literal Ninja is from Feudal Japan. Regarding the Ninja chat this is all demonstrably false.

        You're interpretation is far too literal. This is hyperbole and he's very obviously joking. The use of the word "literal" while speaking so figuratively is also known as irony. Sheesh!

          A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.