[Ilugc] more perl

  • From: girishvenkatachalam@xxxxxxxxx (Girish Venkatachalam)
  • Date: Fri, 14 Dec 2012 20:18:25 +0530

I was browsing the CPAN search site today looking for modules.

Those of you that dunno perl will not know CPAN.

Even if you do know perl I wonder how many know that perl comes pre
installed with certain modules.

Stuff like Digest::MD5, Digest::SHA1, Tie::File and many others.

For stuff that  you wish to do that is not distributed when you
install perl  you require to install like this:

# perl -MCPAN -e 'install Text::Reform;'

This is going to bug you before you find that it installs the module requested.

This also illustrates that perl has a fairly extensive command line
processing engine which has made a lot of
 per one liners popular.

The examples I showed for file processing line by line looking for
patterns and modifying some can be done
 using one liners.

But they are for advanced use.

In fact,

$ perl -pi -e 's/girish/nobody/' /tmp/ex.txt

will do an in place replacement which is a cool feature.

-Girish

-- 
Gayatri Hitech
http://gayatri-hitech.com

Other related posts: