Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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
Node Status?
node history
Node Type: note [id://600133]
[Lady_Aleena]: I'll just have to search for the files using the subs and open them up.
[Discipulus]: nice Perl dreams, folks.. shower->Dumas->bed
[erix]: pere ou fils?
[Lady_Aleena]: Discipulus, good night.
[Discipulus]: pere, le vicomte de bragelonne.. wonderfull
[erix]: I'll keep that in mind (haven't read), buona notte :)
[Discipulus]: oh erix but is the fourth of cycle;read them in order
[erix]: hm, perhaps I can just read it here
Discipulus zzz...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2017-05-23 19:57 GMT
Find Nodes?
    Voting Booth?