use Scalar::Util qw/reftype/; my @arr = reftype( $x ) eq 'ARRAY' ? @$x : ( $x );