Dan Muey wrote: > Howdy all. > > I have the need to turn off strict refs for one line. > I want to make sure strict refs is back on afterward. > > if(...) { > no strict 'refs'; > ...use refs here... > use strict 'refs'; > } > > Is that how I turn them back on or ??? > (I think all 'use's get done before anything else so it would be pointless to have > it there? ) > > Or does the no strict 'refs' apply only within it's own block so after I'm out of > that if{} statement strict refs are back on?
Hi Dan. 'Yes' to your last sentence. Has anybody said that yet? The use/no for a pragma applies only to its containing block (or file). (It's very non-Perl to explain why, so I won't.) Check out use strict; our $a = 99; my $n = 'a'; { no strict 'refs'; print $$n, "\n"; } print $$n, "\n"; will error only on the second 'print' statement. It's immaterial whether the block is controlled by an 'if', 'while', 'for' etc. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]