Paul wrote:
> Hi, all.
> I was reading the perlsub docs and hit this speedbump:
>
>
>      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.
>
> I failed to parse.
> Could someone elaborate that, please? :)

a statement modifier is any of qw( if unless while until foreach ) after
an unmodified (ordinary) statement. A 'my' statement is something
like

    my $x = 1;

and what this warning is saying is don't use any of the modifiers on
it, as its behaviour is undefined (not 'undef'). Stuff like this:

    my $x = 1 if 0 == 1;

leaves you not knowing anything about the value in $x.

HTH,

Rob




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

Reply via email to