my @test = qw[abc def ghi xyz]; my @res; for (@test) { when (/abc/) {push @res, "abc"; continue} when (/def/) {push @res, "def"; last} when (/xyz/) {push @res, "xyz"; next} default {push @res, "default"} } continue { print "FOR/CONT($_): @res\n"; @res = (); } __END__ FOR/CONT(abc): abc default