--- Rob Dixon <[EMAIL PROTECTED]> wrote:
> >      NOTE: The behaviour of a "my" statement modified with a
> >      statement modifier conditional or loop construct (e.g. "my
> >      $x if ...") is undefined.  The value of the "my" variable
> >      may be "undef", any previously assigned value, or possibly
> >      anything else.  Don't rely on it.  Future versions of perl
> >      might do something different from the version of perl you
> >      try it out on.  Here be dragons.

> Stuff like this:
> 
>     my $x = 1 if 0 == 1;
> 
> leaves you not knowing anything about the value in $x.

Not true, exactly.
As I understand it, I know that

 1) since the test was false, the my() and assignment
    will never be executed.
 2) no my() means any previous value will remain.
    any prior value will still be in effect.

so that if my($x) had previously been assigned with qw/foo bar/, it
will still have the value of 'foo'. 

I'm apparently misparsing the above paragraph, though, because it looks
to me as though it's trying to say that 

my $x = 1;
my $x = 2 if 0;

leaves the value of $x unknown -- as if it might have become polluted
by the action. What I see is that the second my() won't happen, and the
lexical $x will retain a value of 1.

Either I'm misunderstanding the code, the docs, or both, but I think
it's the docs. What are they trying to say? Merely that 

  my $x = 1 if 0;

might not set the variable? That's covered in the FAQ's.
In fact, if $x had no prior value, it might not even get created
(definitely wouldn't in my example), which is what I assumed the point
was supposed to have something to do with. It's just that the language
of the paragraph doesn't parse.

*sigh*


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to