Hi Mark,

"Mark Hedges" <[EMAIL PROTECTED]> wrote:
>
> David Kaufman wrote:
>
>>   my $foo = 'bar' if $baz;
>>
>> I wish it would still DWIM, and by that I mean the compiler should 
>> detect
>> my declaration + assignment + conditional and rewrite it for me as what 
>> I
>> meant which was simply:
>>
>>   my $foo = $baz ? 'bar' : undef;
>
> I disagree.  In the first, you are telling perl that you
> want to create a symbol if a certain condition is true.
> Maybe under some conditions you don't want to create that
> symbol.

Fair enough.  I've never felt the need to (or read anyone elses code that 
chose to) conditionally declare a lexically local variable, but I agree 
thatm if someone felt the need to do so, then:

  my $foo if $necessary;

shouldn't behave any differently than:

  my $foo = 'bar' if $necessary;

So I'd be happy with a warning.  And, you know, not corrupting memory... 
:-)

-dave




Reply via email to