in reply to Re: a REFERENCE of array of hashes
in thread a REFERENCE of array of hashes
Hi guys,I have tried to work out the answers but the code seems have quiet a few error.I've tried this to create a reference array of hashes:
I am worndering whether @client I've created is a reference array of hashes? or is it a real array of hashes.use strict; use warnings; use Data::Dumper; my $data = "members.dat"; open (DAT, $data) or die "\"$data\" not existed or can't be opened!\n" +; my @client; my @fields = qw/memberno firstname lastname subjuct score/; while (<DAT>) { next if ( /^Surname/ or /^-/ ); my @values = unpack 'A15A15A15A15A15', $_; my %entry = map { $fields[$_] => $values[$_] } ( 0..$#fields ); push @client, \%entry; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: a REFERENCE of array of hashes
by why_bird (Pilgrim) on Jun 24, 2009 at 13:41 UTC | |
Re^3: a REFERENCE of array of hashes
by why_bird (Pilgrim) on Jun 24, 2009 at 13:38 UTC | |
by Anonymous Monk on Jun 24, 2009 at 13:57 UTC | |
Re^3: a REFERENCE of array of hashes
by Anonymous Monk on Jun 24, 2009 at 11:37 UTC | |
by why_bird (Pilgrim) on Jun 24, 2009 at 13:25 UTC |
In Section
Seekers of Perl Wisdom