Johnson, Reginald (GTI) wrote: > I am doing an example from Perl Objects, References & modules. I suspect > many of you already use this book as a reference. > My hash is showing the address instead of the name and I'm not sure > why. Here is my output. > > this is person=>HASH(0x20040014) > this is who=>HASH(0x20040014) > HASH(0x20040014) is missing preserver > HASH(0x20040014) is missing sunscreen > HASH(0x20040014) is missing water_bottle > HASH(0x20040014) is missing jacket > > Here is the code > #!/usr/bin/perl
use warnings; > use strict; > > my @gilligan = qw(red_shirt hat lucky_socks water_bottle); > my @skipper = qw ( blue_shirt hat preserver sunscreen); > my @professor = qw(sunscreen water_bottle slide_rule batteries > radio); > > my %all = { > "Gilligan" => [EMAIL PROTECTED], > "Skipper" => [EMAIL PROTECTED], > "Professor" => [EMAIL PROTECTED], > }; If you had included the warnings pragma then perl would have told you what is wrong: Reference found where even-sized list expected at Hash_problem.pl line 8. You need to assign a list to %all, not an anonymous hash: my %all = ( Gilligan => [EMAIL PROTECTED], Skipper => [EMAIL PROTECTED], Professor => [EMAIL PROTECTED], ); John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>