sub fooge { die "fooge() needs two arguments\n" unless (@_ ==2); my ($foo, $bar) = (shift, shift); # or @_ are equally safe. # ... }