ystore,
Perl (generally spelled with only the first letter capitalized, though
thought by some to be an acronym for Practical Extracting and
Reporting Language) is the friend of millions of programmers around
the world. There are languages with better structure, languages that
compile faster, and languages that just plain make more sense. But
where Perl really stands out is its flexibility, a feature that allows
you to do things several orders of magnitudes faster than other
languages. In my personal experience, I have been able to do things
with Perl in mere hours that would have taken me several days or even
weeks to do any other way.
The Camel Book's (Programming Perl by Larry Wall, Tom Christtiansen &
Randal L. Schwartz) Preface does a great job of summing up the strong
points of Perl, a portion of which I will quote here: "In a nutshell,
Perl is designed to make the easy jobs easy, without making the hard
jobs impossible. And what are these 'easy jobs' that ought to be
easy? The ones you do every day, of course. You want a language that
makes it easy to manipulate numbers and text, files and directories,
computers and networks, and especially programs. It should be easy to
run external programs and scan their output for interesting tidbits.
It should be easy to send those same tidbits off to other programs
that can do special things with them. It should be easy to develop,
modify, and debug your own programs too. And, of course, it should be
easy to compile and run your programs, and do it portably, on any
modern operating system. Perl does all that, and a whole lot more."
Whether you are using Windows, Linux, Macintosh, UNIX, even other
esoteric operating systems like BeOS and OS/2 Warp, you can run Perl,
and in most cases compile the same code you write on one system
directly on another. In most cases, the things you want to do in Perl
have already been mostly done for you, thanks to the extensive code
libraries available in the Comprehensive Perl Archive Network (CPAN)
Perl particularly excels in manipulating data, with extremely powerful
regular expression and text management functionality. As a practical
example, a global search and replace over an entire filesystem can be
done with a single line of text, combining UNIX and Perl to replace,
for example, every occurance of a web domain throughout an HTML site:
find -name *.html | xargs perl -pi -e
's/cvs.oldserver.com/cvs.newserver.org/g'
The Camel and the Llama (Learning Perl) books are a great start for
learning the fundamentals. You will also want to research the CPAN
site in great detail. Once you learn the basics, the possibilities
for using Perl will be limited only by your imagination.
In closing, to quote once more from the Camel, "Perl is a language for
getting your job done." If you do any serious work with computers, no
amount of time studying and working with Perl could ever be considered
wasted.
Sites Cited:
CPAN
http://www.cpan.org/
Global Search and Replace With Perl:
http://hacks.oreilly.com/pub/h/73
Google Search Strategy:
perl xargs global search replace |