sub determineType { $sub_ref = shift; $rval = $sub_ref(@_); return @$rval if( ref($rval) eq 'ARRAY' ); return %$rval if( ref($rval) eq 'HASH' ); } #### sub execSubroutine { my $sub = shift; my @sub_ret = &{$sub}(@_); # Return an list if we get a list with more than one value # this will satisfy callers expecting lists and/or hashes return @sub_ret if (@sub_ret > 1); my $rval = $sub_ret[0]; # If we have a ref de-reference and return. if (my $type = ref($rval)) { return @$rval if ($type eq 'ARRAY'); return %$rval if ($type eq 'HASH'); } # If not a ref and the caller wants a list, give it to them if (wantarray) { return @sub_ret; } # Otherwise return a scalar return $rval; }