in reply to Optional parameter before reference

Easiest way to do it is to check how many parameters you're being passed, or work from the other end.
sub verify{ my $optional; $optional = (@_ == 2) ? shift : "default value"; my $ref = shift; ... }
or
sub verify{ my $ref = pop; my $optional = pop; #becomes undef if only one param }