Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: use slack;

by epoptai (Curate)
on Dec 21, 2000 at 07:23 UTC ( [id://47706]=note: print w/replies, xml ) Need Help??


in reply to Re: use slack;
in thread use slack;

Thanks for the occult info autark! Please correct me if i'm wrong but as far as i can tell saying no strict "refs" inside a tight loop only turns strict refs off for the duration of the loop.

Aside from this one exception employed for a well-tested condition (for a huge optimization):

if($in){ foreach(@actions){ unless($_ eq /one|/){ if($in eq $_){ no strict "refs"; &$_()}}}}
the (now 400 line) script uses strict. Since i know how to play by the rules why not also start to break them, since it seems to pay off so well when done carefully?

UPDATE: I responded too quickly, as autark explained in the chatterbox, this is the perfect solution. I get to do what I want without breaking strict with:

if($in){ foreach(@actions){ unless($_ eq /one|/){ if($in eq $_){ do{\&{$_}}->()}}}}
Joy!

Replies are listed 'Best First'.
Re: Re: Re: use slack;
by autark (Friar) on Dec 21, 2000 at 07:45 UTC
    The strict pragma is lexically scoped, so it will only affect the innermost block of your program.

    Now, there is no rule saying that you have to use strict;, it's only good advice :-). Though, I'm a bit curious how breaking these "rules" have paid off ?

    Autark.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-19 03:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found