RE: detecting a hash of hashes

2001-12-06 Thread Sidharth Malhotra
Try the ref() function. if (ref($hash{$data}) eq 'HASH') {} Hth. Sid. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Pete Emerson Sent: Thursday, December 06, 2001 9:03 AM To: [EMAIL PROTECTED] Subject: detecting a hash of hashes Here is an exampl

Re: detecting a hash of hashes

2001-12-06 Thread Jonathan E. Paton
Hi, Use the "ref" function, it returns the type (or false if not a reference). Assuming it's either a scalar or another hash do this: foreach my $data (keys %hash) { if (not ref($hash{$data})) { print "\$hash{$data} --> $hash{$data}\n"; } else { foreach my $second (keys %{$hash{$dat