You have an error in the LOOKUP hashref. Here’s a simplified version that will output what you expect–
use strict; use warnings; my $rec = { TEXT => "Fred loves Ethel", SEQUENCE => [ 13, 27, 47, 98 ], LOOKUP => { cars => 'Buick', dog => 'hound' } }; print $rec->{TEXT}, "\n", $rec->{SEQUENCE}[0], "\n", $rec->{LOOKUP}{dog}, "\n";
Notes — Find the difference between your LOOKUP and mine. Always use strict and warnings (at least when starting). You can pass a list of things to print so only one is necessary. The newlines generally have to be asked for as well. Welcome to the monastery and good luck with Perl! It’s a terrific language.
(Update: LanX usually welcomes newcomers… Sorry you had to settle for me. :P)
In reply to Re: Learning about Arrays and Hashes - printing pieces of them
by Your Mother
in thread Learning about Arrays and Hashes - printing pieces of them
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |