in reply to Error Checking for Array Reference
For the example you posted and assuming you want $response->{Item}->{ID} to be an array ref, davido's solution is probably the easiest - just force XML::Simple to return an array regardless of the number of elements.
If you need a more generalized solution, take a look at the ref function. It will allow you to check references like this:
if( ref( $var ) eq 'ARRAY' ) { # $var is a ref to an array }
HTH
|
|---|