On Wed, Sep 07, 2005 at 05:19:55PM -0700, brucer @ gsg-lnx-bld1. cisco. com 
wrote:
> The following program invokes beta once instead of twice.
> Extremely non-intuitive.
> moving the "#' down one line fixes it.
> 1) seems like it shouldn't compile.
> 2) $c is static and keeps its value between invocations if
>    one instead of "if (0)" one has "if ($b)"
> This is boiled down from a real program, of course.

The short answer is "don't do that".

C<my $v if 0;> has already been deprecated in the development version of
Perl because its behavior is too confusing.  The behavior cannot be
changed because too many people rely on it.

$ bleadperl -wle 'my $v if 0;'
Deprecated use of my() in false conditional at -e line 1.


-- 
Michael G Schwern     [EMAIL PROTECTED]     http://www.pobox.com/~schwern
'All anyone gets in a mirror is themselves,' she said. 'But what you
gets in a good gumbo is everything.'
        -- "Witches Abroad" by Terry Prachett

Reply via email to