Friday, June 18, 2010

Perl: Read Text Files and Filter Data

Perl is the language for text manipulation. Its designed in a way, to handle the data in whatever the format, and process out the data into the desired format. Lets see some text processing examples from an external text file.

Step One:
Open a text file for reading,
 #!/usr/bin/perl
 open (FILE, 'data.txt');
 while () {
   chomp;
   print $_;
 }
 close (FILE);
 exit;

No comments:

Post a Comment