in reply to A way to avoid repeated conditional loops

You can always disable the warning if it bothers you. Of course, its only a significant gain if the alpha appears early in the file. And, the sub overhead may kill the gain, if the processing involved isn't very significant:

#! perl -slw use strict; sub doBeta(_) { print 'Beta'; } sub doit(_) { if( /alpha/ ) { print 'Alpha'; *doit = \&doBeta; return; } doBeta( $_ ); } doit( $_ ) while <DATA>; __DATA__ beta beta beta beta beta beta beta beta beta alpha beta beta beta beta beta beta beta beta beta beta beta beta

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.