Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^2: Perl is dying

by Anonymous Monk
on Jul 14, 2006 at 18:15 UTC ( #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?

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.


      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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://561287]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2018-02-21 08:07 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (276 votes). Check out past polls.