In article <[EMAIL PROTECTED]>, James
Edward Gray II wrote:
[...]
> On Friday, October 17, 2003, at 10:15 AM, Kevin Old wrote:
[...]
>> Yes, this is almost what I need, but instead of the headers being in
>> the first column, I need the in the first row.
[...]
This is my new version (with headers in first column for each).
Improvements/advice welcome...
my %array_ref;
while (<DATA>) {
next if /^#.*/;
chomp;
my @fields = split /\s*;\s*/, $_;
push @{$array_ref{1}}, [ @fields[0..7] ];
push @{$array_ref{2}}, [ @fields[8..14] ];
push @{$array_ref{3}}, [ @fields[0, 8..14] ];
push @{$array_ref{4}}, [ @fields[15..18] ];
}
# use Data::Dumper;
# print Dumper(\%array_ref);
# exit;
foreach my $nbr (sort keys %array_ref) {
print "Array $nbr\:\n";
# loops through ea. array
foreach (@{ $array_ref{$nbr} }) {
# prints formatted row
foreach my $col (@{$_}) {
printf "%16s|", $col;
}
print "\n";
}
}
-Kevin
--
Kevin Pfeiffer
International University Bremen
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]