If an object has been blessed, Perls ref built in will return the class, not its type. Thus this code might not do what you expect for blessed array references.
Scalar::Util's reftype function consistantly returns the type and might be a better choice here:
use Scalar::Util qw/reftype/;
my @arr = reftype( $x ) eq 'ARRAY' ? @$x : ( $x );