On Jan 23, 2008 10:29 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> Chas. Owens wrote:
> >
> > On Jan 23, 2008 10:07 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> >>
> >> Along these lines, can someone explain to me why
> >>
> >> use strict 'vars';
> >> my $name = 'data';
> >> print foreach @$name;
> >>
> >> produces no error, when
> >>
> >> use strict 'vars';
> >> print foreach @data;
> >>
> >> does?
> >
> > Because use strict 'vars' runs in the compile phase and the symbolic
> > reference is not resolved until the run phase.
>
> Of course. Thanks Chas. I think the docs could do with a tweak here.
snip
They seem fine to me:
from perldoc strict
"strict refs"
This generates a runtime error if you use symbolic references
snip
"strict vars"
This generates a compile-time error if you access a variable that
wasn't declared via "our" or "use vars", localized via "my()", or
wasn't fully qualified.
snip
"strict subs"
This disables the poetry optimization, generating a compile-time
error if you try to use a bareword identifier that's not a sub-
routine, unless it is a simple identifier (no colons) and that it
appears in curly braces or on the left hand side of the "=>" sym-
bol.
The effects and when they happen is fairly clearly spelled out.
Humorously enough,
use strict subs;
violates itself, but it can't catch the error (since it occurred
before $^H was set).
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/