use Ref::Util 'is_arrayref'; if (is_arrayref ($foo)) { do_something (); }