in reply to Creating the right type of array...
Update: Hehehe... looks like i was beaten to it... oh well... the more the merrier, right?#!/usr/bin/perl use warnings; use strict; open FILE, "input" || die "Couldn't open file"; my %hash; while ( <FILE> ) { chomp; my ( $key, @rest ) = split /,/; foreach ( 0 .. 4 ) { $rest[$_] = "" unless ( defined( $rest[$_] ) ); } push @{ $hash{$key} }, \@rest; } # To print out every 1st row of all the ones beginning with QTY print "$_->[0]\n" foreach ( @{ $hash{QTY} } ); # total number of entries for the category print scalar( @{ $hash{QTY} } ); # print a specific row of data print "@{ $hash{QTY}[2] }\n";
|
|---|