I am working in e-publishing company where mainly text processing, HTML, XML process are handled. I am not professional in CGI concepts. As far as i know there is no language equivalent to Perl in text processing and handling regex.
Could you tell us any other language good in handling text processing and regex?
Re: Perl is dying
Replies are listed 'Best First'.
I'd have to agree here. We do not use Perl for any web applications yet 98% of our jobs are written in Perl because I could write one script and use it on either Windows (running Activestate Perl) or on Unix running the installed version of Perl and you wouldn't need to do anything different becuase of the platform (granted there was a lot of platform specific operations that are done behind the scenes in a custom module). Being able to create a custom module allows us to have scripts that use functions out of that and if we update something, that update is carried out for all scripts using it (one change rather than having to change several hundred scripts in a variety of places). I also use it to parse log files and put them into a coherent format for reporting. Perl also has the advantage of being very fast. I've pulled reports out of logs and been able to parse large amounts of data within a few minutes. Perl's regex's are great as well, I'm in the process of convincing our software vendor to enhance the use of regex's in a program they wrote in Perl.
I don't think it's dying, perhaps it's just not growing as quickly as some would like. Of course if it really stops growing, then it will die (like any other language in the world - take Latin for instance). However, my opinion is that's a long way off since there is a lot of work being done, especially with CPAN to extend what you can do with Perl.
Of course if it really stops growing, then it will die...
Not that I have any particular disagreement with your overall point here, nimdokk; but I strongly disagree with the meme that "if it ain't growing, it's dying". There's a third possibility: sustaining. And in many scenarios sustaining has significant advantages over growing (not to mention, over dying). To take just one example from biology: humans stop growing at some time around 20 years of age* but we don't really start dying until maybe 70 or 80*. Sure, adolescence has its perqs; but, all things considered, I'm quite happy to be an adult.
* The exact ages don't matter; let's not split hairs.
like any other language in the world - take Latin for instance
However, my opinion is that's a long way off since there is a lot of work being done, especially with CPAN to extend what you can do with Perl.
Actually, that's part of the problem with Perl's waning comparative popularity: languages like Perl, Python, and Ruby gain a lot of mindshare traction via their suitability for the Web, but CPAN actually acts as a demotivator in that realm. When people come up with new code in Perl that they want to share with the world, they stuff it in CPAN — but all those people out there looking to use Perl on their shared-server webhosting accounts are often pretty badly disenfranchised by that approach because they can't just go around installing modules willy-nilly when they often don't even have shell access, let alone root access, on the servers.
That doesn't even bring up the problem with dependency hell that CPAN-wrangling can often impose on our otherwise apparently simple solutions to commonplace problems. CPAN is great, but it suffers some issues, and these issues most affect the most fertile ground for growing Perlists.
I totally agree. I planed to port my little web appication to Perl, because using PHP is just ugly. But, CPAN is also ugly. I don't want to install hundrets of modules just to get some little things to work. Also I hate installing modules without APT. I have a small webserver, even I don't want to use CPAN. I'm still stuck with PHP. Perl is better for programming than PHP is, but CPAN let me stay away.
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.
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.