A grep on the data to check for four spaces followed by a digit at the beginning of each line works:
use strict; use warnings; use List::MoreUtils qw/natatime/; my $it = natatime 5, grep /\A\s{4}\d/, <DATA>; while ( chomp( my @lines = $it->() ) ) { my $letter = 'A'; my $acctNum = do { $lines[0] =~ /\s+(\d+)\s+(\d+)/; $1 . $2 }; push @lines, " acctnum=$acctNum"; print for map { s/\s+/$letter++ . ' '/e; "$_\n" } @lines; } __DATA__ Place your data here...
In reply to Re^7: raw data formatting
by Kenosis
in thread raw data formatting
by teamassociated
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |