Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Perl is dying

by Anonymous Monk
on Jul 14, 2006 at 18:15 UTC ( [id://561287]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl is dying
in thread Perl is dying

Could you tell us any other language good in handling text processing and regex?
Ruby.

Replies are listed 'Best First'.
Re^3: Perl is dying
by webfiend (Vicar) on Jul 14, 2006 at 21:40 UTC
    Ruby is good at text manipulation. So is Python, even if it does look a little different. The thing is that text manipulation is an innate part of what Perl is. It's so tightly ingrained into the language that Perl is often a first choice for such tasks even if other, prettier languages are available.
      If you're familiar with both Ruby and Perl, you'd know that text manipulation is as much an innate part of what Ruby is at it is an innate part of what Perl is.

      Perl beats Ruby for such tasks for the following three reasons: people already know Perl, there are more (and better) libraries for Perl, and Perl is somewhat faster on benchmarks. Those are listed in what I believe to be decreasing order of how commonly they come up.

      Note that I did not include in the list that Perl is better for text manipulation. That is because I believe it isn't. Ruby can generally express the same concepts as concisely or more concisely than Perl. Ruby has several nice features that Perl does not, for instance I like the fact that Ruby natively lets you iterate over the lines in the string. And Ruby avoids some gotchas that Perl has, for instance using $& somewhere in your program doesn't slow down every other regular expression like it does in Perl.

        True enough. I fall firmly into that first camp. I already know Perl, so it's often my first choice. This is in spite of the fact that I've been using Ruby for various sundry projects for about 5 years now. Plus colleagues in my colorful employment history get all jittery if I mention a language other than Perl or Java in the context of "say, couldn't we do this in X?"
        I think there is one thing where Perl have some advantage in text processing over Ruby - it is handling Unicode. Granted this is only second hand - but I've heard Ruby has some deficiencies here.

        for instance using $& somewhere in your program doesn't slow down every other regular expression like it does in Perl.

        In perl5.10 there is a new way to do this that doesnt come with a generalized performance penalty. In fact, Perl 5.10 expands the regex syntax greatly and offers some nice new optimisations.

        ---
        $world=~s/war/peace/g

      Beauty is in the eyes of the beholder. Or was it ... beerholder? ;-) I'm one of the few Czechs that don't drink beer, so I don't know for sure. In either case I find Perl pretty enough. And even though I'm all for simplicity in dressing, I do like the sigils and other ornamentation of Perl. OTOH, eg. Visual Basic is simply ghastly. Like a row of dull, concrete block of flats. No ornaments, no room for fantasy, no room for living.

      My experience is that Perl's regex syntax is slightly slicker than Ruby's, though the difference is so slim as to be negligible for most purposes. Python's, meanwhile, is an ass sandwich -- it's almost as bad as PHP's regex syntax, and in some ways is even worse.

      For text manipulation requiring nontrivial regexen, I'll stick to Perl (first choice) or Ruby (a very close second), thanks. For something simple enough, I'll go ahead and do something with PHP. I'm likely to stab myself in the leg, intentionally, repeatedly, before choosing Python for regexen under any noncoercive circumstances.

      print substr("Just another Perl hacker", 0, -2);
      - apotheon
      CopyWrite Chad Perrin

        Funny, that's how I feel about PHP's regex handling. Python's regex libraries are a distant third to Perl and Ruby, but PHP makes me itch. Perhaps that's the issue for me in the first place: PHP makes me itch, so their regex library is just going to be more itchiness for me :)
Re^3: Perl is dying
by Anonymous Monk on Jul 14, 2006 at 23:51 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://561287]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-19 06:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found