sub checkLine { # returns an (error) string that describes # what the line contained. # I place the if behind the return because # if I look at the code, I have an error message # and want to know what caused this message. return "! found at start of line." if /^!/; return "Line too short" if !/.{5,}/; return ""; }; if {/BEGIN/i) { # here I use a prefixed "if", because a longer block follows. };