Let me preface this with this is actually working code and that I'm simply just looking for a better way to go about doing the follow, really the optimal way of do it.
I basically am reading an xml file and for a given key I'm creating anArray. However, there are cases where the key can have many xml elements in which xmlin returns an Array or the other case where just a single element (a scalar) is returned. Is there any other way to approach this, a better way?
if ( ref($xmlin->{$key}) eq "ARRAY")
{
@anArray = @{$xmlin->{$key}};
}
else
{
push @anArray, $xmlin->{$key};
}