Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: References with hashes

by chargrill (Parson)
on Feb 15, 2007 at 04:50 UTC ( #600133=note: print w/replies, xml ) Need Help??

in reply to References with hashes

This simple change gets your program closer to working:

#!/usr/bin/perl use strict; use warnings; my %address; $address{Bray} = { Name => 'Braden Mailloux', Str => 'kapellenstr. 1', EMail => '' }; my $email = $address{Bray}->{EMail}; print_address($address{Bray});

After this change, running it only gives the error "Undefined subroutine &main::print_address called at line 17."

You could also do this:

#!/usr/bin/perl use strict; use warnings; my %address = ( Bray => { Name => 'Braden Mailloux', Str => 'kapellenstr. 1', EMail => '' }); my $email = $address{Bray}->{EMail}; print_address($address{Bray});

I believe it has something to do with the hash key not existing as you're trying to declare it lexically, but I couldn't find anything concrete (to me) in the docs. See my and perlsub for more details.

s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://600133]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2023-03-27 00:48 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (63 votes). Check out past polls.