in reply to hashes of arrays ??
That happens pretty often in files I deal with. In that case, you have 2 options.
If none of the header/footer/blank lines have all the fields, you can just do
(assuming you open OUTFILE above the loop, and want to write all these items to it, as someone else suggested...)if(@array>14) { print STDOUT "$array[13]\t$array[14]\n"; print OUTFILE .... }
If you have a "header" type line, or line of dividers or something like that, then you'll have to add some checks to skip this, like:
with the correct regular expressions for your data, of course. Make sure that SALES can never appear on a normal line, for instance, if you're going to use that as a screen.while(<FILEHANDLE>) { next if /------/; # skip divider line next if /SALES/; # skip header line next if /TOTAL/; # skip summary line next if /^$/; # skip blank lines ... }
Hope this helps!
--
Mike
|
|---|