in reply to strict refs on / off process time

Strict is a compile-time thing. You only pay once each time you turn it on or off, and it sets flag bits on the op nodes in the optree. There's no runtime penalty as such.

OTOH, I think you probably ought not do it. Use real sub refs, and if you need symbolic lookups, look them up in a hash that you've previously populated. There's more and better error checking that way.

Replies are listed 'Best First'.
Re^2: strict refs on / off process time
by Aristotle (Chancellor) on Nov 20, 2002 at 15:17 UTC

    How so? For the vars and subs strictures that is certainly true, but refs can only be checked at runtime to see if they're hard or symbolic.

    Update: thanks.

    Makeshifts last the longest.

      Sure, but that checking time is a constant, since regardless of your strict setting perl still needs to know what kind of data is in the scalar. Strictness only determines what perl does after the type is determined.

      Besides, as I said, turning stricture on and off has no runtime penalty, since nothing is done at runtime to turn it on and off. Each op has a set of flags in it that determine a number of behaviors, including stricture. Turning strict on and off just determines, at compile time, what bits get set for the ops that are generated by the compiler. When those ops are actually run the strict setting is embedded inside the ops along with all the other flags.