develooper Front page | perl.beginners | Postings from February 2002

Re: Multidimensional hashes..

Thread Previous
Chas Owens
February 5, 2002 21:58
Re: Multidimensional hashes..
Message ID:
Take a look at perldoc -f each and perldoc -f keys.  Normally I do
something like this:

foreach my $key (sort keys %hash) {
	print "$key => $hash{$key}\n";
	print fiddle($hash{$key}), "\n";

On Tue, 2002-02-05 at 20:34, Lorne Easton wrote:
> Hopefully an easy one for you guys.
> Let's say that you want to have a hash that has a descriptive name (say of a
> PC)
> and some other inportant imformation.  This information I want to be
> associated
> with the PC in that it is a second dimension to the hash value "Name" being
> it's name..
> Is there an easy way of iterating through the hash based on the
> computername..
> I.E: I want to have the first computername returned, the get the values for
> it
> and so on, the same way you could do with foreach and an array..
> Could you please provide a simple example that you could use to do this??
> I hope that this makes sense.. Cheers..
> Lorne
> -- 
> To unsubscribe, e-mail:
> For additional commands, e-mail:
Today is Boomtime the 37th day of Chaos in the YOLD 3168
Hail Eris!

Missle Address: 33:48:3.521N  84:23:34.786W

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About