I think that you should check the length of @_ and if it is 1, then make sure that that one item is not only a reference but a refernce to an array.
sub regardless { return unless @_; my @array = @_; if (@array == 1) { my $ref = ref($array[0]); if ($ref) { return unless ($ref eq 'ARRAY'); @array = @{$array[0]}; } } return wantarray ? @array : \@array; }
In reply to Re: Detecting Subroutine Input Type
by Mr. Muskrat
in thread Detecting Subroutine Input Type
by doran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |