in reply to Exiting a loop trickery

I believe the command you are looking for is last

Just Another Perl Alchemist