[Melbourne-pm] Postfix conditionals and creating lexicals
Alfie John
alfiej at opera.com
Thu Jul 12 14:51:41 PDT 2012
On Fri, Jul 13, 2012, at 02:47 AM, Damian Conway wrote:
> The behaviour of a "my...if 0 construct is officially an accident of
> implementation. And is at least partially documented as such in the
> "perlsyn" manpage (under "Statement Modifiers"):
>
> 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.
Ahh. I've never seen any reference to that before. Thanks for pointing
it out.
> However, as "perlsyn" mentions, this relies on undefined side-effect of
> the implementation and is not guaranteed to keep working in future
> versions of Perl. Indeed, in Perl 5.10 and later, if you 'use warnings',
> you get a compile-time warning about the construct.
Maybe it's in a later version? I'm under 5.10.1 and it's not giving me
warnings.
Dragons begone!
Alfie
--
Alfie John
alfiej at opera.com
More information about the Melbourne-pm
mailing list