Here is an example of what I'm doing to detect whether I've got a scalar value in my 
hash
or a hash of hashes:

#!/usr/bin/perl -w

use strict;
my %hash;
$hash{name}='Pete';
$hash{color}{favorite}='Blue';
$hash{color}{car}='Silver';
$hash{color}{house}='White';
foreach my $data (keys %hash) {
  if ($hash{$data}!~/HASH\(\S+\)/) {
    print "\$hash{$data} --> $hash{$data}\n";
  } else {
    foreach my $second (keys %{$hash{$data}}) {
       print "\$hash{$data}{$second} --> $second\n";
    }
  }
}

Is there a better way to do this that doesn't use a regex to detect the existence
of a hash vs. a scalar value?
        Pete


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to