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.
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 }
In Section
Seekers of Perl Wisdom