I am a newbie to PERL but have a script that parses a tab delimited text file, and creates multiple text files from it, based upon the first 5 characters found in each line.
What I am trying to figure out is whether there is a way to ignore the first 5 characters in each line when I write each line from the source file into the appropriate log file.
The code that writes the data in the corresponding log is:This code works but includes the first 5 characters which were use to determine the appropriate LOG to write the line to.open(LOG, "$file"); while (<LOG>) { chomp($_); (@data) = split(/\t/, $_); (@zip) = split(//, $data[0]); $string = ""; for ($i=0; $i<=4; $i++) { # $string .= "$zip[$i]"; $string .= "substr($data[0], 7, 500)"; } # # match 1st 5 with the zip file # if ($z eq $string) { print NEW "$_\n"; } } close(LOG);
Thanks in advance for your noble assistance!
In reply to text file parsing with chomp by fjdb3
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |