http://www.perlmonks.org?node_id=135533


in reply to array or scalar, that's the question

Well, Parham and Juerd summed up the most common ways to do it. But for the sake of tmtowtdi, here is YAW (yet another way ;)

Rewrite the return portion of someonesFunc() to always return a scalar, either a string/number or an array refrence.
my $tmp = someonesFunc(); if ($ref $tmp eq 'ARRAY') { # use @$tmp as an array } else { # use $tmp as a scalar }