Welcome to the Monastery | |
PerlMonks |
Re (tilly) 1: How does strict work?by tilly (Archbishop) |
on Feb 17, 2001 at 09:53 UTC ( [id://59094]=note: print w/replies, xml ) | Need Help?? |
If you check in perlvar you will find out that $^H is an
internal and highly magical variable. It is just a
collection of flags with rather special scoping semantics.
What strict does is flip the appropriate bits to what
they need to be to cause certain things to (not) be checked
when you want them to (not) be. If it helps, I am willing to treat it as black magic and hope that the phase of the moon is right... :-)
UPDATE A couple of other pieces of magic though. First of all when you see an eval, Perl remembers what the correct value of $^H needs to be when it is called. Secondly within a file it needs to essentially do local $^H = $^H; while when it goes out and compiles another file it would have to do local $^H = 0;. So the magic isn't all that magic, it just looks mysterious because of when it is happening. If you want to test this explanation, each of the following tests another aspect of its behaviour: (People on windows may need to switch quotes.)
In Section
Seekers of Perl Wisdom
|
|