# checking whether argument is a subroutine reference if (!UNIVERSAL::isa($callback, 'CODE')){ } # popping last option parameter my $options_ref = @_ && UNIVERSAL::isa($_[-1], 'HASH')? pop(): {};