Philip Morley wrote:
$VAR1 = {
'level1' => {
'level2' => {
'level3' => {}
}
}
}
The above is the contents of a multi-dimensional hash I have produced from
parsing an XML String. (The Data::Dumper formatting has been adjusted for
brevity).
What I want to do is check whether level3 is "null" (i.e. contains no value
or sub-hashes), but I can't work out a way of expressing this.
I have the reference to the hash, named $XMLRef, and when printing
something like:
print "$$XMLRef{level1}{level2}{level3}";
I get a HASHREF printed.
How can I evaluate if $$XMLRef{level1}{level2}{level3} is null?
Maybe something like this:
my %hash = (
'level1' => {
'level2' => {
'level3' => { }
}
}
);
my $XMLRef = \%hash;
print scalar keys %{$XMLRef->{level1}{level2}{level3}}, "\n";
__END__
--
,-/- __ _ _ $Bill Luebkert ICQ=162126130
(_/ / ) // // DBE Collectibles Mailto:dbe@;todbe.com
/ ) /--< o // // http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs