If all your columns are fixed-width, you can use unpack
use strict; use warnings; while(<DATA>) { my ($colA, $colB, $colC,$colD) = unpack "A19A15A7A45"; $colC = "N/A" if $colC eq "XYZ" and $colD =~ /Region/; print "$colA -- $colB -- $colC -- $colD\n"; } __DATA__ ValuesInColumn1 DataColumnB XYZ RowDescription|RowCode|Suppli +er ID::Region ValuesInColumn1 DataColumnB XYZ RowDescription|RowCode|Suppli +er ID::Region ValuesInColumn1 DataColumnB XYZ RowDescription|RowCode|Suppli +er ID::Region ValuesInColumn1 DataColumnB XYZ RowDescription at RowCode ValuesInColumn1 DataColumnB ABC RowDescription at RowCode
In reply to Re: Split lines in file to columns
by hdb
in thread Split lines in file to columns
by Magnolia25
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |