use Scalar::Util 'reftype'; if (reftype ($foo) eq 'ARAY') { # spot the typo do_something (); } #### use Ref::Util 'is_arrayref'; if (is_arrayref ($foo)) { do_something (); }