[newbie] printing a hash

From: David (auto87829_at_hushmail.com)
Date: 02/28/04


Date: Sat, 28 Feb 2004 20:42:15 +1100

I can't really visualise what's going on in this code. We're simply reading
splitting each line of a file and saving the result in a hash, right?

How can I print the contents of the hash?

open(FILE, 'orig.txt') or die "Can't open orig.txt: $!";

my @fields = qw/a b c d e f g h i j k/;
my $record = <FILE>;

while (<FILE>) {
    chomp $record;
    my %hash;
    @hash{@fields} = split(/\t/, $record);
}

print "$. records processed.\n";

close FILE;



Relevant Pages