my $tmp = someonesFunc(); if ($ref $tmp eq 'ARRAY') { # use @$tmp as an array } else { # use $tmp as a scalar }