in reply to Re^2: Can a single key have different value assigned to it
in thread Can a single key have different value assigned to it
It's a hash of arrays
%info is a hash
$info{lastnames} is an array reference
To take a page out of Basic debugging checklist tutorial
use Data::Dump; dd { lastnames => [ qw/ ro sham bo / ] }; __END__ { lastnames => ["ro", "sham", "bo"] }
Hmm, lets try that again
use Data::Dump; my %info; push @{ $info{lastnames} }, 'ro'; push @{ $info{lastnames} }, 'sham'; push @{ $info{lastnames} }, 'bo'; dd \%info; __END__ { lastnames => ["ro", "sham", "bo"] }
Thats better. Last demo
use Data::Dump; my %info; $info{lastnames}[0] = 'ro'; $info{lastnames}[1] = 'sham'; $info{lastnames}[2] = 'bo'; dd \%info; __END__ { lastnames => ["ro", "sham", "bo"] }
Any time you're wondering about something , write yourself a little program like these three :) hashofarrays.01.pl, hashofarrays.02.pl, hashofarrays.03.pl
Does a hash of arrays make sense for your use case, maybe :) maybe @records is a better fit, I can't tell yet
|
|---|