in reply to next and last within subs

I would avoid the subroutine and use continue like this:
for my $entry (@somearray) { ... if ($x > $stop) { last; } elsif ($y ne $text) { foobar(); } else { next; } ... } continue { # increment a count # print some debug info # ...a few other things }