> 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? ) > > You can turn it back on like that. "use" happens at > compile-time, but strict checking also happens at > compile-time, so it all works out correctly (with some help > from the magcial behavior of the special $^H variable). > > > > > 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? > > Yes, that's true as well. (It's documented under perldoc > perlvar, search for > $^H) > > Sometimes you want to localize the action to just the > right-side of an assignment. For example: > > use strict; > our $bar = 1; > my $ref = 'bar'; > my $foo = $$ref; # error: symbolic reference > > You can do that with: > > my $foo = do { no strict 'refs'; $$ref }; > Ooohh cool. Thanks for the info, I'll tuck that way under my hat also!
Thanks Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]