IT Community - Software Programming, Web Development and Technical Support

Perl its - strengths

This is a discussion on Perl its - strengths within the Perl forums, part of the Software Development category; Pattern matching: Perl's greatest claim to fame has always been the tight integration of regular expressions into the base ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > Perl

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 03-12-2008, 01:14 AM
JSureshkumar JSureshkumar is offline
D-Web Sr.Programmer
 
Join Date: Feb 2007
Location: in someone's heart
Posts: 139
JSureshkumar is on a distinguished road
Send a message via Skype™ to JSureshkumar
Default Perl its - strengths

Pattern matching:

Perl's greatest claim to fame has always been the tight integration of regular expressions into the base language syntax. For most developers, perl was the first time they ever used a regular expression.

As a result, perl has always been the go-to language for any task that involves pattern-matching input. A typical use of this capability is to scan an input stream for name/value pairs and split them. Another is parsing log files with a fixed but variable length format. It's not for nothing that a lot of the popular log file auditing packages are written in perl.
__________________
J Suresh Kumar
Google Hacks
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 03-12-2008, 01:22 AM
arjkhanna arjkhanna is offline
D-Web Incredible
 
Join Date: Mar 2007
Posts: 1,949
arjkhanna is on a distinguished road
Default Re: Perl its - strengths

In-place editing:

Combine regular expressions with the ability to edit files "in place" from the command line, and perl makes a dandy tool for performing a batch modification on a group of files

For example

suppose you have renamed the
Code:
 /home/george directory to /home/curious,
and want to update a few hundred scripts in the /usr/lib/yellowhat directory to point at the correct new path, then the you can just update with one liner

Code:
# perl -i.bak -p -e "s#/home/george#/home/curious#" `find . -print`
Now, this is a fairly simple example and could have easily been done using a tool such as sed, but the important thing is that you could have used any arbitrarily complex perl program as the filter, and done highly complex manipulations. Imagine an area code getting split and having to replace a single area code with one of two depending on the original exchange in hundreds of files. In perl, it would be a snap.
__________________
A.Rajesh Khanna
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 03-12-2008, 01:27 AM
bluesky bluesky is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 667
bluesky is on a distinguished road
Default Re: Perl its - strengths

A replacement for shell scripts:
One of the worst things about shell scripting—whether in bash, sh or csh—is that the syntax of the scripts themselves is fairly hard to read.

By using perl as a scripting language instead of a "traditional" shell, you can use much more C-like syntax without sacrificing functionality.

Thanks
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 03-12-2008, 01:50 AM
JSureshkumar JSureshkumar is offline
D-Web Sr.Programmer
 
Join Date: Feb 2007
Location: in someone's heart
Posts: 139
JSureshkumar is on a distinguished road
Send a message via Skype™ to JSureshkumar
Default Re: Perl its - strengths

As a database manipulation tool:

One of perl's strengths has always been the strong database interoperability through the DBI and DBD libraries. If you need to create a quick database report, or convert between a database and some other form of data storage, you can very easily whip up a little utility using perl in very short time.
__________________
J Suresh Kumar
Google Hacks
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 03-12-2008, 01:59 AM
shaalini shaalini is offline
D-Web Architect
 
Join Date: Apr 2007
Posts: 633
shaalini is on a distinguished road
Default Re: Perl its - strengths

As a cross-platform language:

Because perl is interpreted, perl scripts don't need to be recompiled when moved from platform to platform. And because companies like ActiveState have produced strong ports of perl to platforms such as Windows, most perl programs will run without modification even if they do advanced things such as database connectivity, file system modification or network programming

Thanks
__________________
Shaalini.S
Be the Best of Whatever you are...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
what is perl? inder Perl 2 01-07-2009 09:17 PM
How to set Perl Interpreter within perl script sivaramakrishnan Perl 1 07-19-2007 05:45 AM
Perl Code from PHP sivaramakrishnan PHP Programming 1 07-16-2007 10:15 AM
When would you not use Perl for a project? vadivelanvaidyanathan Perl 0 07-15-2007 06:24 PM
Perl? swoosh Perl 2 03-19-2007 03:31 AM


All times are GMT -7. The time now is 06:22 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0