for( $test_value ) { /pattern1/ and do { something; last; }; /pattern2/ and do { something else; last; }; do { default action; #no last required }; }