Enjoy#!/usr/local/bin/perl -w use strict; $|++; use constant TITLES => 1; my $data = {}; while ( <DATA> ) { my $row = [ split /,/ ]; push @{$data->{$row->[0]}}, $row; } sub totals_report { my $data = shift; print "Totals Report:\n" if TITLES; foreach ( sort keys %{$data} ) { print $_ . ":\t" . @{$data->{$_}} . "\n"; } } sub print_col { my $data = shift; my $col = shift || 0; print 'Column ' . $col . " print out:\n" if TITLES; foreach my $type ( sort keys %{$data} ) { print $type . ":\n" if TITLES; foreach my $row ( @{$data->{$type}} ) { print "\t" . ( $row->[$col] || '[none]' ) . "\n"; } } } totals_report( $data ); print "\n\n"; print_col( $data, 3 ); __DATA__ HDR,831 Reconciliation,200008081441EST BGN,11,000000158,20000808,10520000 OTI,GH,BT,WEDI620000802,159 AMT,2,231644 AMT,BT,231644 AMT,NP,0 QTY,46,10 QTY,53,0 QTY,54,10 QTY,55,0 TED,ZZZ,BATCH AWAITING 831 OTI,TR,CK,0021000095,159,000101416 TED,ZZZ,MOD CHECK ON RDFI-ID FAILED
-- Casey
In reply to Re: Creating the right type of array...
by cwest
in thread Creating the right type of array...
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |