Hi,

I am trying to parse a xml file. Some of the tags are empty, like 
this one:
# Data::Dumper output
 'order_number' => {},

I have been trying to check if there is any content within the 
hashref (say for order_number) returned by XML::Simple but I am not 
getting the results I had hoped for.

If I do this:

if (defined($ref->{'order_number'}) && $ref->{'order_number'} =~ 
/\w+/ ) {
        print "found $ref->{'order_number'}\n"; 
}

I get "found HASH(0xacacfe8)". 

Using 'defined' gives me the same results. What is the correct way to 
check for content/values within a hashref? Is a element always 
defined if it is within the XML even if it has no values? Should I  
scalar it first?

Thanx in advance,
Dp.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to