foreach (@w) { print "working with $_... "; if (/^>>/ ) { print "error message\n" } elsif (/^\s*([<>])\s*(\S+)/) { print "separated '$1' from '$2'\n" } elsif (/^\s*\|/ ) { print "pipefront\n" } elsif (/\|\s*$/ ) { print "pipeend\n" } else { print "\n" } }