On Tue, Sep 16, 2008 at 06:11:30PM +0200, Moritz Lenz wrote:
> Stephen Simmons (via RT) wrote:
> > sub max($a, $b) {
> >     if defined $a && defined $b {
> >             if $a >= $b { return $a } else { return $b }
> >     }
> >     elsif defined $a { return $a }
> >     elsif defined $b { return $b }
> >     else { return undef }
> > }
> 
> in trunk, r31178 this gives the desired output (specifically '3 <-4>'),
> so I'll close this ticket.
> 
> (I suspect it was either a problem with defined() which was improved
> lately, or a parsing problem).

I think that C<defined> was being parsed as a listop instead of a named
unary, thus the C<if> statement above was being parsed as

    if defined( $a && defined($b) ) { ... }

Pm

Reply via email to