if ((reftype($x) || '') eq 'ARRAY') { print "\$x is an array ref (@$x)\n"; } else { print "\$x is not an array ref\n"; }