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

Re: How to iterate through a hash of hashes?

by elwarren (Priest)
on Jan 11, 2005 at 20:08 UTC ( #421401=note: print w/replies, xml ) Need Help??


in reply to How to iterate through a hash of hashes?

Just to be different, save a step and use each:
#!/usr/bin/perl use warnings; use strict; my %hash = (); $hash{"192.168.0.1"}{"randy"} = "thomas"; $hash{"192.168.0.1"}{"ken"} = "samual"; $hash{"192.168.0.2"}{"jessie"} = "jessica"; $hash{"192.168.0.2"}{"terry"} = "ryan"; foreach my $ip (keys %hash) { while (my ($key, $value) = each %{ $hash{$ip} } ) { print "$key = $value \n"; } }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2023-04-01 19:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?