in reply to raw data formatting
Perhaps the following, which uses List::MoreUtils's natatime to grab five elements at a time from a list of file lines, will be helpful:
use strict; use warnings; use List::MoreUtils qw/natatime/; my $it = natatime 5, <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...
Update: Added a chomp; removed the non-destructive substitution modifier (/r) and a print "\n"; line.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: raw data formatting
by teamassociated (Sexton) on Nov 16, 2012 at 01:45 UTC | |
by Kenosis (Priest) on Nov 16, 2012 at 01:52 UTC | |
by teamassociated (Sexton) on Nov 16, 2012 at 02:24 UTC | |
by Kenosis (Priest) on Nov 16, 2012 at 03:24 UTC | |
by teamassociated (Sexton) on Nov 16, 2012 at 13:25 UTC | |
|