It seems that many react and cringe when they hear the word Perl. It's a funny reaction to me. Because, all of the documentation for Perl is superb. Writers like +Randal L. Schwartz or +Gabor Szabo will guide you with great thoughtful tutorials in their respective books and on-line websites.
My reaction to comments to the negative is that most are ill-informed and if a prospective student were to spend just two hours reading +Randal L. Schwartz's Learning Perl, they will have built a solid foundation upon which to expand their technical skill set.
Perl is found resident on most Unix, BSD, and Linux systems by default. It often plays a large part in many 'behind the scenes' activities running on your system. If you invest the time to learn, I would say it would not be a wasted effort as once done, Perl will be their in your toolbox for you to grasp and use on so many occasions throughout life.
Will Perl eventually die? Some say it will. But if you go by a recent study from RedMonks that measures the spectrum of programming languages in use on GitHub, it is evident that Perl is quite alive and well.
![]() The RedMonk Programming Language Rankings: January 2013 |
Put forth the initial effort to learn Perl. While the initial hill climb is steep, once mastered, Perl is powerful in the hands of the learned. Perl can and does do the 'heavy lifting' in so many ways as exemplified by the CPAN repository. CPAN is one step away for anyone with Perl with a diverse set of open source modules ready to fill gaps in your programming needs.
Perl isn't just for writing projects; it is also good for quick 'one-off' utilitarian functions and can be quite convenient when invoked right from the Bash command line. This one-liner upper-cases an entire text file:
$ cat sample.txt Practical Extraction Report Language $ perl -pi -e “tr/[a-z]/[A-Z]/” sample.txt $ cat sample.txt PRACTICAL EXTRACTION REPORT LANGUAGE
Often, I visit +Gabor Szabo's excellent Perl5 Maven website to see what he is up to and come away learning something I didn't know before. At his site you'll find his most excellent new book Perl Maven for Beginners, including in eBook downloadable format. You can also find regular posts of his ideas and a dedicated section to tutorials especially made to coddle and encourage the newcomer to venture into this feature-rich, powerful programming language. Here's a tutorial on reading a comma separated value (CSV) file and the requisite code:
#!/usr/bin/perl use strict; use warnings; use Text::CSV; my $file = $ARGV[0] or die "Need to get CSV file on the command line\n"; my $csv = Text::CSV->new ({ binary => 1, auto_diag => 1, sep_char => ',' # not really needed as this is the default }); my $sum = 0; open(my $data, '<:encoding data-blogger-escaped-die="" data-blogger-escaped-fields="$csv-" data-blogger-escaped-file="" data-blogger-escaped-my="" data-blogger-escaped-n="" data-blogger-escaped-not="" data-blogger-escaped-open="" data-blogger-escaped-or="" data-blogger-escaped-ould="" data-blogger-escaped-utf8="" data-blogger-escaped-while="">getline( $data )) { $sum += $fields->[2]; } if (not $csv->eof) { $csv->error_diag(); } close $data; print "$sum\n";
I can assure you from experience that for every 1 line of Perl, writing an equivalent piece of code in C will yield a ratio of 10 or more lines to accomplish same. This is not to suggest that Perl serves to replace the venerable C language--certainly not. But there are many applications where Perl excels and is the right tool for the job, particularly systems integration and the Internet web development.
So, please. Make the investment. Randal and Gabor will be there to help you. I promise. Learn Perl and it will be with you to serve your needs always.
-- Dietrich
Hello,
ReplyDeleteyou have some strange stuff in the code for CSV reading - lines 7, 16, 24.
Yes, I see that. I know that the code needs escapement in certain languages (HTML, CSS), but I am not sure if any is needed for Perl. This is what is embedded in the page:
ReplyDelete#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV;
my $file = $ARGV[0] or die "Need to get CSV file on the command line\n";
my $csv = Text::CSV->new ({
binary => 1,
auto_diag => 1,
sep_char => ',' # not really needed as this is the default
});
my $sum = 0;
open(my $data, '<:encoding data-blogger-escaped-die="" data-blogger-escaped-fields="$csv-" data-blogger-escaped-file="" data-blogger-escaped-my="" data-blogger-escaped-n="" data-blogger-escaped-not="" data-blogger-escaped-open="" data-blogger-escaped-or="" data-blogger-escaped-ould="" data-blogger-escaped-utf8="" data-blogger-escaped-while="">getline( $data )) {
$sum += $fields->[2];
}
if (not $csv->eof) {
$csv->error_diag();
}
close $data;
print "$sum\n";
---------
The Javascript makes a pass over the code to add escapement if needed.
So, I might check to see if their is an update that resolves this bug.
Thanks
--Dietrich
Be wary of using GitHub's data for judging Perl's popularity. GitHub treats anything that looks like a programming language and it cannot parse as Perl, including, until recently, the GPL copying notice. Currently, it is still known to count some Python and Bash programs as Perl.
ReplyDeleteCan you supply documentation that supports this assertion?
ReplyDeleteHipster language users want to kill perl.
ReplyDeletebut They don't realize the destination of their favorite languge environment is perl. :)
They are just enjoying making the new wheel without known there are already robust and high-quality wheel(cough..cough Perl).
Stop making the new wheel and Just USE PERL! haha
Do you know that Perl 5 is 3 years younger than Python and just 1 years older than Ruby ?
ReplyDeletePerl 5 is not yet old enough to die.
The day good to die for perl will be also good season for Python and Ruby dead.
Stop FUD on Perl, hipsters ... :)
This is a great article. Very well articulated.
ReplyDeleteWhat has this article to do with Perl? Your examples can be dealt with by other languages in much the same manner and the same or less amount of code.
ReplyDeleteTherefore the article totally misses its point. You haven't told us WHY everyone wants to declare Perl dead. You haven't told us WHY Perl is better suited for the (trivial) tasks you presented as examples.
Not dead. More active than ever. Smaller slice in a bigger pie, but more people absolutely working with Perl than ever. More new releases. More CPAN submissions. Cooler code. And Perl6 in the form of Rakudo is actually mostly usable now.
ReplyDeleteThanks for stopping by Randal!! :)
ReplyDeleteJust now I ordered the book "Learning Perl" , to get started . Since I now installed FreeBSD OS on new purchased hardware, learning perl will accommodate me just fine. Wish me luck. Thanks.
ReplyDeleteLive Long and Prosper !
Learning Ruby is more rewarding IMO. It has a cleaner syntax, can also do those famous powerful one liners, has OO built right into the language, has a great regexp engine (Oniguruma) and is only mildly slower than Perl.
ReplyDeleteRuby? Come again after making a valid lexical variable & scope. it's not beauty. Rubist just want to assert that they are beauty themselves. have you seolusly learnt Perl? :) STOP propaganda like. kindergarten boys with shallow knowledge.
DeleteThank you for your $1.25 contribution to my profitability!
ReplyDeleteAs ugly as Perl can be sometimes, it works, and it works damn well. It, Groovy, and Bash are simply fun to write in.
ReplyDeleteNice article, even though there's not much in it about people actually wishing for Perl to die (not as much as Java, at least).
Reminds me of learning to respect Rexx.
ReplyDeleteI don't see why wanting to kill Perl, it has its own niche. But calling this for debate is asking for language wars, which nowadays consist mostly by Perl, Python, Ruby and Scala people.
ReplyDeleteI think Common Lisp is much more versatile (as a language, not counting libraries) than any of these, but the other languages (yes, including Perl) are much more alive, so what could I do?
I've been using perl since 1993. I describe it as the "Swiss Army Knife" of programming languages. My one complaint with perl is that, after learning it, I have trouble convincing myself I need to learn another programming language and unfortunately the world is always enamored with the latest, greatest shiny new thing.
ReplyDeleteCheers,
Dave