while () { chomp; if (/^\*{3} (.+)/) { print "Found the following strings within body $1\n"; next; } /patterna/ && print "matched on stringa\n"; /patternb/ && print "regex on string b\n"; /patternc/ && print "C match\n"; }