On Mon, Jan 21, 2002 at 12:50:38PM -0800, Larry Wall wrote:
> : What's the chance that it could be considered so?  
> 
> In most other languages, you wouldn't even have the opportunity to put
> a declaration into the conditional.  You'd have to say something like:
> 
>     my $line = <$in>;
>     if $line ne "" { ... }
> 
> Since
> 
>     if my $line = <$in> { ... }
> 
> is Perl shorthand for those two lines, I don't see how one can say that
> the variable is more related to the inside than the outside of the block.
> One can claim that the code after the C<if> may not be interested in
> C<$line>, but the same is true of the block itself!  The conditional
> only decides whether the block runs.  It's not part of the block.

But are we not at risk of introducing another form of

  my $x if 0;

with

  if my $one = <ONE> {
    ...
  }
  elsif my $two = <TWO> {
  }

  if ($two) {
    ...
  }

Graham.

Reply via email to