Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: A way to avoid repeated conditional loops

by BrowserUk (Patriarch)
on Aug 24, 2011 at 19:26 UTC ( [id://922180]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://922180]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-03-29 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found