Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: iterating a hash of (complex?) arrays

by Roy Johnson (Monsignor)
on Apr 27, 2005 at 03:56 UTC ( [id://451843]=note: print w/replies, xml ) Need Help??


in reply to iterating a hash of (complex?) arrays

Is this about what you're looking for?
for my $label (sort keys %family) { my @names = @{$family{$label}}; print "$label\n"; for my $name (@names) { print ref($name) ? "\t@$name\n" : "\t$name\n"; } }
Notice that you don't generally have to iterate through the index of an array. Note also that you were fetching an array ref into an array (@names). You need to dereference it, as I have done here.

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: iterating a hash of (complex?) arrays
by tcf03 (Deacon) on Apr 27, 2005 at 04:02 UTC
    Thanks, that worked well.
    Ted
    --
    "Men have become the tools of their tools."
      --Henry David Thoreau

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-03-29 14:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found