Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

I want you to convince me to learn Perl

by kasxperanto (Acolyte)
on Sep 24, 2013 at 22:27 UTC ( #1055553=perlquestion: print w/ replies, xml ) Need Help??
kasxperanto has asked for the wisdom of the Perl Monks concerning the following question:

So, I'm an embedded firmware engineer who lives in the realm of C 99% of the time, and I am trying to decide on a scripting language to use for general work around my system.

Like most everyone else I've narrowed it down to Perl or Python. And as I do not use scripting too frequently in my area of focus I can only commit to learning one or the other.

I've done my share of googling and have come to the conclusion that everyone else thinks I should learn Python. It is cleaner, more directly readable, has built-in OO, is more popular, and has a new version already in use. My logical side says this is the one.

But that little voice in my head that made me learn Vim, Sed, AWK, Bash, and other (relatively) ancient tools is nagging me in the direction of Perl. I also enjoy working with Linux, so may be doing some hobby work at a higher level there when I have more free time.

So, as Perl Monks, I want you to convince me that my logical side is wrong and I really should learn Perl. (Make the little voice happy ;) )

Comment on I want you to convince me to learn Perl
Re: I want you to convince me to learn Perl
by choroba (Abbot) on Sep 24, 2013 at 22:50 UTC
    If you already know C, Bash and AWK, you almost know Perl. There is only a little you have to learn, as Perl heavily borrows from all the three.

    Cleanness and direct readability are subjective. Popularity is fugacious.
    Perl also has a new version in use (it's 5.18).

    Pick the language whose community makes you more comfortable. You probably will need its help in the beginning, sometimes.

    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      I emphatically second this.

      Like you, I was heavily involved in embedded systems design (back in the 80s) where assembly and C ruled the world. Eventually, I became more involved with system administration on Unix and then bash, sed and awk took over. It was in the mid-90s, when Perl had matured into something that resembles what we have today, that I fully embraced it not only for simple scripts and reports, but full-blown applications such as billing systems for an ISP.

      I think it is the common heritage that Perl shares with C, the Unix culture and attitudes, that has made it my favorite language by far. For me, it was a natural extension of C. Perl strongly resembles what many would call C pseudo code, especially when it comes to text processing. The two languages have a similar syntax and structure in mind, and there is a cheat-sheet that lists Perl gotchas that C programmers are prone to being caught by because the languages are so similar.

      I can not speak with regard to Python as I have never had reason to learn it, Perl has done everything I have ever asked of it from simple one-off scripts to major systems including the implementation of am ISP, web hosting, and a credit card issuing/processing company.

      On time, cheap, compliant with final specs. Pick two.

      Well ... there's a lot to learn, but you can learn it as you go and work with the subset that matches the features of C, Bash and AWK in the meantime.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

      If you already know C, Bash and AWK, you almost know Perl.

      I emphatically disagree.

      Someone with that knowledge might be able to start writing code in Perl without too much difficulty, but what makes Perl a great language is how it does many things incredibly different to great advantage. It challenges assumptions one has taken as fact after coding in C and C-like languages.

Re: I want you to convince me to learn Perl
by sundialsvc4 (Monsignor) on Sep 24, 2013 at 23:03 UTC

    That’s easy:   look at both!

    Python, despite its very peculiar use of indentation as a lexical property of the source-code (“white space is meaningful!”), is a very powerful list-processing language with many inspirations and similarities to LISP ... without those Little Irritating Silly Parentheses.   Perl, on the other hand, has a marvelous way with text files.   Both are workhorses, and general-purpose.   Both can be used to do the others’s work, but both have their own unique comparative strengths, and since both are equally at-hand . . .

    In reality, you’ll find yourself using several different scripting languages, and production systems quite-commonly contain an oddly-fitting hodgepodge of them.   Therefore, I would suggest that you split your attention between these two.   Maybe you’ll trend toward a favorite, or maybe not.   I never drew favorites ...   This breadth of knowledge will surely help you when you peel-the-onion of a new system and look at how they built it and say . . . :-O !!

      > is a very powerful list-processing language with many inspirations and similarities to LISP

      Sigh ... Perl has much more in common with LISP then Python, i.e. translating LISP code to Perl is much easier.

      Please show counter examples¹ or stop repeating this nonsense!

      Cheers Rolf

      ( addicted to the Perl Programming Language)

      ¹) except docstrings.

        Obviously, I did not intend my words to be taken quite so literally as to suggest that one would “translate from” one to the other.   Rather, the Python language has many list processing builtins and idioms ... a general flavor for doing things, if you will ... that draws many inspirations from the LISP approach to doing these same things.

        We hardly need to “translate code from X to Y,” anyway, since we always have ready access at-hand to both worlds.   Our professional tool-boxes contain many tools in parallel.

Re: I want you to convince me to learn Perl
by LanX (Canon) on Sep 24, 2013 at 23:04 UTC
    I think you should also consider Ruby, but talking about Python:

    I don't like Python for three reasons:

    1. I don't like the community! I met too many incredibly arrogant people, who thought that bashing other languages makes them good programmers. If you like people who start hate-flames after mentioning things like "emacs" (or "vi" or whatever), instead of accepting a "vive la difference" attitude, you should learn Python.

    2. I don't like the pypi, IMHO it can't match CPAN in usability and quality.

    3. I'm critical about this "There is only one way" design of Python. Like lamdas which only allow one statement or the problems with simple closure variables. It's not the features it's the restrictions.

    IMHO Python is a much more isolated language, Ruby (semantically) and PHP inherited a lot from Perl, transit is easy. Even JS borrows so many semantics from Perl that it almost looks like a subset.

    Learning Perl means tolerating many different concepts and widening your horizon, Python OTOH produces fundamentalists.

    Last but not least where is Pythonmonks, where are Pythonmongers? =)

    Cheers Rolf

    ( addicted to the Perl Programming Language)

    PS: For completeness, you didn't ask me for Python pros... ;-)

      > I don't like the community! I met too many incredibly arrogant people, who thought that bashing other languages makes them good programmers.

      See also this charming G+ account of a Pythoniza.

      Especially remarks like "Perlprogrammiererkonzentrationslager" are revealing ...

      Cheers Rolf

      ( addicted to the Perl Programming Language)

        Since I don't know german, I'm going to read that as "Perl programmers drink concentrated lager"...which I don't have a problem with :-)

        So, just don't mess with my reality by telling me what it really means, 'kay?

        Actually, "Perlprogrammiererkonzentrationslager" is not funny, even less so in German. It means "Perl Programmer Concentration Camp" and has bad and ugly overtones, especially in German.

        For certain Perl is not bondage & discipline or discrimination & xenophobia.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        My blog: Imperial Deltronics
Re: I want you to convince me to learn Perl
by ww (Bishop) on Sep 24, 2013 at 23:07 UTC

    Among the advantages of selecting Perl:

    • CPAN -- a library of thousands of well-tested, reliable modules that will save you re-inventing the wheel, time after time...
    • Its utility as a language for quickly protoyping complex programs -- and from which prototypes, translation to C (and company) becomes just a SMOP...
    • The fact that its tools/capabilities include such as OO; GUI development; and so on ... and so on.

    One can surely belabor this list at much greater length... but I'll post this and encourage the Monks to provide futher incentive to choose Perl.

    But, before I go, I second the observations by Monsignor choroba challenging your "lolgical side" with respect to readability and popularity.

    If I've misconstrued your question or the logic needed to answer it, I offer my apologies to all those electrons which were inconvenienced by the creation of this post.
Re: I want you to convince me to learn Perl
by Will_the_Chill (Pilgrim) on Sep 24, 2013 at 23:08 UTC
Re: I want you to convince me to learn Perl
by kbrannen (Sexton) on Sep 24, 2013 at 23:42 UTC
    I'll agree with the others, if you already know C, sed, awk, then perl should be easy for you to pick up.

    I've recently started looking at Python just to have a clue about it. One of the problems I've hit is the "new version". Some places support 3.0, some only 2.7, and a few only 2.6. "Places" maybe be installs or frameworks/libs or even an app you want to use or work on.

    I can pretty much take any Perl program from the last 10 years and run it on a "modern version", like 5.14+. In fact I frequently run the same Perl code on 5.8, 5.10, and 5.14. The only issues I've found are sometimes the supporting modules on CPAN will change on me and then I have to either freeze the module with my program or upgrade my program. That doesn't happen very often considering how many wonderful modules are on CPAN. What I'm trying to say is that newer versions of Perl rarely break old code, they only add new features which means Perl programs can be "long lived".

    If you choose Python, I don't think it would be a bad choice; however, I do think Perl would be the better choice. ;)

    HTH,
    Kevin
Re: I want you to convince me to learn Perl
by Old_Gray_Bear (Bishop) on Sep 24, 2013 at 23:54 UTC
    Why restrict yourself, look at Perl AND Python, gaining familiarity with more than one tool set is not a bad thing.

    While you are at it look at JavaScript and Node (or at least node.js).

    Having serious exposure to multiple languages increases the number and variety of gigs you can tackle. It puts you in the position of letting the Problem Domain determine the Language -- time sensitive jobs in C; text handling in in Perl or Python; regular expressions in Perl; web-code in Perl, PHP, or AJAX (or node.js and the web-server of your choice). Increased flexibility reads as increased marketability.

    In addition to increasing the chances of getting hired/assigned to interesting projects, there are cross-pollination effects -- the way that I look at designing a Perl code effects the way I look at writing Python tools for Ops Monitoring folk. Thinking about how Perl's CGI module works influences the code that I write in JavaScript (and conversely). You don't need to be a Super Star in the language, but you do need to be able to truthfully say (and demonstrate) that you are a Journeyman Programmer in whatever language the project needs.

    While you are at it, don't restrict yourself to learning one or two other languages. I am currently working my way through node.js and JavaScript (again, after I read Doug Cockcroft's little book). When I have reached my comfort level there, it's time to go back to FORTRAN; my third kid is working on some interesting problems involving mapping software for the Forestry Service. All of the code is written in either FORTRAN or Python, and there are some interesting issues and problems there. (Think real-time maps of forest fires....)

    ----
    I Go Back to Sleep, Now.

    OGB

      I definitely agree that there's no reason not to learn multiple languages, I just can't spend the time on more than one right now.

Re: I want you to convince me to learn Perl
by toolic (Chancellor) on Sep 25, 2013 at 00:24 UTC
    You've already convinced yourself to learn Perl over Python, and you need us to validate your choice (I do this with my wife all the time). Consider it done.

    Perl is well-suited for "general work around my system". perlintro shows you how to do about 90% of everything you need to get started.

      > (I do this with my wife all the time)

      Thats interesting!

      May I ask how you are usually validating your wife?

      Any benchmark suite you recommend?

      Did her maintainability change over time and does she scale well in multiuser context?

      Cheers Rolf

      ( addicted to the Perl Programming Language)

      PS: childish grin ... xD

        Rolf, you are one sick puppy. No wonder you love Perl as much as so many of the rest of us do. :)

        On time, cheap, compliant with final specs. Pick two.
Re: I want you to convince me to learn Perl
by talexb (Canon) on Sep 25, 2013 at 02:31 UTC

    Some of my first programming work was embedded programming on a 6809 for a statistical multiplexer. Later, it was in 68000 assembler and C for a bigger stat mux; I wrote C for about 15 years, by which time I was starting to get into scripting, and found awk, which led to Perl. As this was the mid to late 90s, I suspect Python and Ruby didn't exist yet, so Perl was the obvious choice for me.

    You've already received some suggestions to try both languages -- I heartily recommend you try that. Go ahead and try to solve some problems you currently have with Perl, Python and Ruby -- see what language suits you, see how the community supports you.

    I'm happy to say that I still have a little smile on my face whenever I start writing a new piece of Perl. It's a great language, still under development, and the killer app is CPAN, a varied library of Everything Under The Sun.

    I hope this makes your little voice happy!

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Re: I want you to convince me to learn Perl
by BrowserUk (Pope) on Sep 25, 2013 at 02:33 UTC
    So, as Perl Monks, I want you to convince me that my logical side is wrong and I really should learn Perl.

    Go Learn Python.

    If it doesn't drive you nuts with its stupid rules you'll probably be happier there. But if it niggles and irritates you come on back.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Go Learn Python

      well, I did so. In the argument "line noise vs. significant whitespace", I opted for the latter and did not rue it. Of course there's more differences than that, but also they have more things in common than some people say.

      So, why am I coming back to perl? Simple:

      1. Perlmonks - I am not disgusted by the Python community, but this one is superior, even if it should be run by benevolent dictators :-)
      2. CPAN

      Of course, given that I started with FORTRAN and COBOL, both Perl and Python are big improvements to the art of programming :-) and anyway I am using both (and some other languages, too).

        In the argument "line noise vs. significant whitespace", I opted for the latter

        It's not just the significant whitespace issue; though that is possibly the most frequently annoying. Other things I remember:

        • Scoping is weird.
        • Documentation is crap.
        • Library (dis)organisation.
        • colons; thus the lack of multiline anonymous subs.
        • The general lack of coherence.

        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
        The problem I had with Python was that there were plenty of places where, because everything is an object, I found a number of areas where things like integers were copied by reference rather than value. Maybe it's better now and maybe I wasn't doing things The One True Python Way, and it has been a few years, but I remember being really puzzled by that one.
Re: I want you to convince me to learn Perl
by HelenCr (Monk) on Sep 25, 2013 at 05:38 UTC
    Perl was invented and designed by a philologist (an expert in human spoken languages) - Larry Wall. This entails, that once you grasp and understand the Perl spirit and internal logic, the entire language "makes sense", you realize that its design is clean and logical, and it's fun and easy to develop in it.

    An example of the philological influence: human languages have inflections. (In English, for example, nouns are inflected according to single or plural; verbs get inflected according to tense (past, present or future) etc.

    In Perl, the parallel is the "sigil" system: the little sign: [$, @, %] you put in front of the variable. It signifies the "context".

    So for example, if "Array" is an array, then normally you will refer to it as: "@Array", but when you refer to an array member, you have to state: "$Array[$i]".

    Logic of similar power governs the referencing/ dereferencing system.

    You don't have these in Python - therefore, it less fun to write, and more error-prone when engaging in heavy and complex programming.

      I'm also a fan of Perl over Python, and I come to it from literature, so I'm actually even a fan of implicit contexts - but saying that said contexts make Perl less error-prone really doesn't match my experience or anything I've seen. It can make it less verbose for some things once you understand contexts deeply.

      Also, given the decisions made in Perl 6 about sigil invariance, it seems pretty clear that the overall drift of the language is away from heavy use of implicit context to determine what code does.
      for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";
        pobocks: the Perl internal logic and language consistency are much broader and deeper than just being about implicit context.

        Like I said, when you consider together the Perl referencing/dereferencing system, together with the sigil methodology, the language becomes very powerful, clear, and unambiguous, simultaneously.

        I can bring innumerous examples.

        Helen

      Kiel Esperantisto, cxi tiu trajto vere tre interesas min. Mi tre felicxas eklerni novajn lingvojn, cxu por programado cxu por parolado.

      (As an Esperantist, this feature is actually quite interesting to me. I'm very happy to learn new languages, whether for programming or for speaking.)

Re: I want you to convince me to learn Perl
by davido (Archbishop) on Sep 25, 2013 at 06:28 UTC

    Neither Perl nor Python would be a bad choice. Both are heavily used. Both are under active development. Both fill many of the same niches (which statement actually sells them both short since their general utility could never be classified as 'niche'.) Both have OO built in. Both are used by some pretty smart people who use them well, and some less capable people who use them poorly.

    Perl has CPAN. CPAN has tens of thousands of modules from thousands of developers. CPAN has smoke testing of every module that gets uploaded, on a broad range of systems and Perl versions. Perl's strong "testing" culture is one of its best features. Not all that glitters is gold, but CPAN has a pretty good track record. Perl is the syntax used to interact with CPAN modules.

    Pick up a copy of Learning Perl, and Intermediate Perl. Each one will take you a week to get through if you are persistent. If those first two weeks with Perl don't make a favorable impression on you, try the same with Python.

    Before I started learning Perl, I spent most of my time with C. Once I started with Perl, I couldn't stop.

    Above all, patiently form your own opinion, and give yourself time to do it. Stroustrup, in The C++ Programming Language makes a wise observation. I'll have to paraphrase it because I don't have the book handy at the moment. He says that when people approach a new language they often find themselves frustrated; every piece of syntax becomes a reminder that this new language isn't the language they're proficient with. Often that's as far as they get before dismissing the new language and going back to what they know. If they would just commit honest effort and have the patience to get past the early awkward stages they would discover what the new language has to offer.

    A lot of Perl haters (or haters of any language) never gave themselves the time to get past the initial awkward stage. Some haters have never even spent any quality time at all with the language. Give yourself a chance, and form your own opinion.


    Dave

Re: I want you to convince me to learn Perl
by hippo (Curate) on Sep 25, 2013 at 09:20 UTC
    everyone else thinks I should learn Python. It is cleaner, more directly readable, has built-in OO, is more popular, and has a new version already in use.

    I am not a pythoner. I've never learned it. However, my knowledge of other languages, especially Perl, has allowed me on occasion to hack some 3rd party python code with some success. Your (or perhaps your correspondents') criteria listed above for advocating python over Perl do need to be debunked.

    1. It isn't immediately clear what you mean by cleaner - maybe it's the syntax, maybe it is the minimalism of the language itself, maybe it is that it does not pollute the rest of the O/S, who can say? Whatever, it sounds very subjective. The only way for you to know which is really cleaner (for whatever your definition of "cleaner" is) would be to try both a see which floats your boat.
    2. I have found Perl to be a very readable language, at least for a native English speaker such as I am. Many of the perlvars are mnemonic, most of the built-ins are English words and lots (although not all) of the syntactic sugar is C-like. Conversely the python which I have read has been difficult, mostly because of the significant whitespace instead of closing braces, etc.
    3. What on earth made you think perl doesn't have built-in OO? Genuinely curious here, as a simple google search for perl OO turns up about six million results. Perl is equally happy as a procedural, object-orientated or functional language.
    4. Ah, popularity, how shall I measure thee? Let me count the ways. Or did you mean populist? Or in vogue? And, when push comes to shove, what does popularity matter compared to getting the job done (and done well and quickly and maintainably)?
    5. When is a version a "new" version and when is it not? Current version of perl is 5.18 released on the 18th of May this year. Current version of python is 3.3.2 released on the 15th of May (ie. 3 days older). Furthermore, Perl is stable with excellent backwards compatibility to 5.10 and a large chunk of today's code will run quite happily on 5.6, which is over 13 years old now.

    I'm sure that there are many good reasons to learn python. There may even be some good reasons to learn python in preference to Perl, but your stated ones are either subjective or easily dismissed.

    Learn Perl. It's a steep curve. As others have said you have a big head start because of sed and awk and C. Perl brings the best of all of those together and a whole heap of magic of its own. I haven't looked back and nor, I suspect, will you. Good luck.

Re: I want you to convince me to learn Perl
by Marshall (Prior) on Sep 25, 2013 at 11:20 UTC

    So, I'm an embedded firmware engineer who lives in the realm of C 99% of the time, and I am trying to decide on a scripting language to use for general work around my system.

    Perl can do everything that C can do (albeit a bit slower, but not by much). Basically Perl code will run about 1/3 the speed, but you can write it 10x+ faster.

    If you go to Fry's, all of the software is written in C. Nothing is written in JAVA. Nothing is written in Python or Perl either. However many huge websites are written in Perl. As a firmware engineer, I would recommend Perl. I've written binary processing stuff in Perl and there are folks here that can help with that.

    I recommend Perl.

      Writing perl^W^WEfficiently writing in perl in fact is so effective that I(/you) will take the speed issue for granted when most of what you write is for one-time use or for use that doesn't require the speed. I write perl and C and Java everyday and curse at C and Java quite a lot for not allowing me to write «my $c = 1;» instead of «int c = 1;» or «private static long c = 1;» or whatever it takes for a local/lexical variable to get in scope.

      I find myself write less and less C as I can do almost anything in perl, and write it over ten times as fast in code that is easier to maintain. Some projects however still need perl: the code cannot be shared by law and perl has no good code-hiding feature.

      Defining a useful data model in C might be quite a challenge. The autovivication in perl is a joy compared to how to deal with data in C and - even worse - in Java.

      Compared to C and Java, changing data-structures, return types etc is so much easier.

      I never wrote anything in python. I however read a lot of python scripts, mainly to fix bugs. I've read enough not to like it. Ruby on the other hand really looked as a good alternative when I would require a good OO scripting language. Python has - in the past - quite often said that they do not suffer from version incompatibilities, but to be honest, that is completely untrue: they suffer just as bad as any other (scripting) language. Most reasons for digging in python where just because of that.


      Enjoy, Have FUN! H.Merijn
        I find myself write less and less C as I can do almost anything in perl, and write it over ten times as fast in code that is easier to maintain. Some projects however still need perl: the code cannot be shared by law and perl has no good code-hiding feature.
        I think that we are on the same page here.
        I am not so sure about the lack of a "code-hiding" feature.

        I use the Active-State Compiler and this thing is pretty hard to "decode". Many years ago, a massive power failure took out my Power Supply and 3 HD's. That trashed my Perl source code for one project, but not my .exe. The .exe code still runs over 5 years with no reported defects - so I am happy about that! If somebody can help me recover the source code, I would appreciate it. But I am skeptical. It is not as easy as one might think.

        I love Perl. A wonderful language.

        A new school quarter started Monday and I'm going to be working with an assembly class. I like it. Perl can kick butt vs this stuff except in very high performance situations.

      Well ... the speed ... it's both right and wrong. If you translate some code statement-for-statement from C to Perl, then Perl will lose hands down. For a large group of tasks a well written Perl script will beat anything you could write in C in reasonable time to pulp. The built-ins of Perl had been hand-optimized for years so if you can implement the task by a few calls to those built-ins, your program will finish sooner than if you attempt to reimplement them in your own code. In most cases it simply doesn't matter though.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

Re: I want you to convince me to learn Perl
by code-ninja (Scribe) on Sep 25, 2013 at 11:30 UTC
    I too am a C programmer and learning Perl hasn't been much difficult. I mean I still need to learn the intricacies of Perl but I know the basics. As stated by choroba, if you know C and the others, you already know Perl quite a bit. Its kinda intuitive if you have a good grasp of C. I may be flaunting but you should check my post. It is not recommended do something like that in Perl because Perl is more feature rich but it tells you that you can do stuff in Perl (given that it is a "scripting" language) that you can do in C.
Re: I want you to convince me to learn Perl
by syphilis (Canon) on Sep 25, 2013 at 12:30 UTC
    the realm of C 99% of the time

    Dammit ... I always read that as "the realm of C99 % of the time" ... and keep thinking "this makes no sense!!!"

    A different (arbitrary) percentage would've been nice. ("89%" probably wouldn't have helped me much, but.)

    Hmmm ... and maybe I assume too much. FAIK, "99%" is not an arbitrary figure at all, but an accurately ascertained value (obtained using Python, no doubt).

    Cheers,
    Rob
Re: I want you to convince me to learn Perl
by pvaldes (Chaplain) on Sep 25, 2013 at 14:40 UTC

    Just another opinion

    Having C, I think that Perl is a good value investment, easy to learn, easy to use, and easy to read. Yes easy to read!. After some time you can write indecipherable code in any language you want, but you can write clean code in perl easily, and you can (and should) document your code so this is not a problem at all. If you want unreadable code try lisp.

    If you want to manage your home system, you should add at least some basic perl tricks to your toolbox. Point.

    Python is useful also, but python code can be brittle. You can destroy your entire program just copypasting it to another place (Yes this is possible) and definitely is more restrictive. When you write perl code you can paint yourself in orange dancing nude at the highway at 4 AM. Some people will tell you that this was not your brightest idea, but if you want it, you can do it... With python not. You can not break the law. You must write your code exactly as python wants, and this is either marvellously fantastic or a real pain in the ass. Your mileage experience can vary.

    With lisp you need first to build the road, and it will be a very nice eight-lane highway... someday.

    Lisp is fragmented. Last time I was exploring it, I had stopped after counting more than 6400 symbols (functions, constants, structures) available; probably there are much more. Learning Lisp is complicated also, but IMHO at the end offers you more value and power for each gram of effort than you invest in Python. If you are a "C guy" looking for new challenges you definitely should consider expose yourself to a language that is more or less "the opposite" to C. You probably will hate me for saying this.

    Let say that C "is" iron, perl is clay, python maybe glass-fiber, and lisp is... mmh, dunno, water?, air?. IMHO you should try Perl, and test the waters also with one of those: Python OR Lisp.

      If you want unreadable code, try XSLT!

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

      I actually have looked into a little bit of Scheme, but it will have to take back seat for something more practical (and more used). I like what I've seen of the functional programming model, though.

Re: I want you to convince me to learn Perl
by Your Mother (Canon) on Sep 25, 2013 at 18:18 UTC
    ,'``.._ ,'``. :,--._:)\,:,._,.: Learn Perl... :`--,'' :`...';\ `,' `---' `. / : / \ ,' :\.___,-. `...,---'``````-..._ |: \ ( ) ;: ) \ _,-. `. ( // `' \ : `.// ) ) , ; ,-|`. _,'/ ) ) ,' ,' ( :`.`-..____..=:.-': . _,' ,' `,'\ ``--....-)=' `._, \ ,') _ '``._ _.-/ _ `. (_) / )' ; / \ \`-.' `--( `-:`. `' ___..' _,-' |/ `.) `-. `.`.``-----``--, .' |/`.\`' ,','); ` (/ (/

    Credit

      It's a pity we can't front page replies. :D

      Does not compile :-( Or is it Python?
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

        Befunge, maybe...

Re: I want you to convince me to learn Perl
by Anonymous Monk on Sep 26, 2013 at 00:21 UTC

    Learn Perl and get Minimal Perl for Unix and Linux People to start being productive right away. You'll get the essentials and chapters like:

    • Perl as a (better) grep command
    • Perl as a (better) sed command
    • Perl as a (better) awk command

    You'll probably get more than enough Perl to achieve most of your goals but if you want to go deeper, this language and the huge library of resources will allow for that. As mentioned, if you want to try Javascript or Ruby later on, the transition will be fairly easy.

    Good luck.

Re: I want you to convince me to learn Perl
by nvivek (Vicar) on Sep 26, 2013 at 06:49 UTC

    I want you to go to Perl for following reasons. First and foremost, there are a lot of communities and active contributors for Perl. It isn't much difficult if you know basic C programming control structures. There are a lot of modules available in CPAN for your day-to-day usage. It is very much helpful for parsing. It supports REGEX in greater extent. Once you start learning REGEX, you would have convinced more and you start referring others to use Perl.

Re: I want you to convince me to learn Perl
by pemungkah (Priest) on Oct 01, 2013 at 22:10 UTC
    At the moment, I write both for a living. They're both good and useful languages, and it's more important - at least for me - to focus on what you get as opposed to the way you express it.

    Perl has CPAN, and a very large community around that; you'll almost always be able to find a module that will get 80% of your work done. Then you only need to write the other 80%.

    Python tends to, in my experience, have islands that are meticulously implemented and tested, where everything is simple and straightforward, easy as pie; and chunks of Terra Incognita outside those islands, where the dragons can be fearsome indeed. The 80-80 rule tends to apply just as much in Python, except you're more likely to find someone on Stack Overflow who has a solution or at least a link to a suggestion.

    One anecdotal thing: I often find, because of Python's "there's only one right and obvious way to do it" philosophy, that refactoring is often much simpler than it would be in Perl, simply because similar code is much more often close to identical, making it much easier to spot the places you should refactor.

    I find Perl's test tooling much simpler to use than Python's, simply because you can get tests written in very few lines with very little scaffolding. The more you lower the barrier to actually writing tests, the more tests you are likely to write.

    So learning either will be of benefit; they're both useful tools; I feel I've actually gained a lot of insight by being considerably more bilingual than I used to be. Often I can see a better solution in one language by briefly considering a problem in the other, even if it's "wow, this is so much harder in language 1; I can just do X in language 2...which is probably what I should have been doing in the first place!"

Re: I want you to convince me to learn Perl
by morgon (Deacon) on Nov 12, 2013 at 00:17 UTC
    For "general work around my system" Perl, Python or Ruby are equally valid ways to go.

    But if you have to work a lot on systems that are not your own an investment in Perl may be better as it is ususally available on all Unix-systems.

    Also I'd say to become really proficient in Perl takes more time but the upside would be that as a Perl-hacker you ususally can deal with Python-code (the converse is usually much harder).

    For non-productive uses of programming languages (obfuscation, golf, poetry) Perl does not really have a contender but that may or may not be your cup of tea.

    There are however many interesting developments in the Python-world (e.g. PyPy) and I think if I had only limited time and only wanted a tool for my own system I'd go for Python.

    But if you can afford a somewhat steeper learning-courve Perl might be a (slightly) better investment.

    But I guess it very much comes down to one's taste.

    Some people just love Python's "there is one right way to do it" approach, some prefer Perl's TIMTOWTDI.

    There is no "better" there, just different philosophies.

    Try one, if you like it stick with it, if not change to something else.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1055553]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (14)
As of 2014-09-19 12:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (137 votes), past polls