develooper Front page | perl.perl5.porters | Postings from September 2011

Re: [perl #100364] exit doesn't match its documentation

Thread Previous | Thread Next
From:
Zefram
Date:
September 29, 2011 06:51
Subject:
Re: [perl #100364] exit doesn't match its documentation
Message ID:
20110929135058.GA12382@lake.fysh.org
Nicholas Clark wrote:
>And C<1 == 1> is an expression? Right?
>
>$ perl -wle 'exit 1 == 1'; echo $?

1 == 1 certainly is an expression, but this parses as exit(1) == 1, so
your code doesn't actually contain 1 == 1 as a subexpression.  This is
perfectly consistent behaviour: unary functions (with unparenthesised
argument lists) bind tighter than infix comparison ops.  It's documented
in perlop.  You can see the same effect here:

$ perl -wle 'print int 10.5 == 10'    
1

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About