http://www.perlmonks.org?node_id=30266

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

You can break out of a subroutine by using the return keyword :

#!/usr/bin/perl -w use strict; sub test { my ($param) = @_; if ($param =~ /e/) { print "e found.\n"; return; }; print "No e found.\n"; }; &test( "test" ); &test( "toast" );
Note that jumping out of the middle of a subroutine is considered bad style by some people who do believe in the statement that every routine should have one entrypoint and one exit.