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

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

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
September 29, 2011 08:42
Subject:
[perl #100364] exit doesn't match its documentation
Message ID:
rt-3.6.HEAD-31297-1317310972-1880.100364-15-0@perl.org
On Thu Sep 29 07:22:07 2011, nicholas wrote:
> On Thu, Sep 29, 2011 at 02:50:58PM +0100, Zefram wrote:
> > 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
> 
> I assumed that that was the reason. Thanks for the clarification.
> 
> I'm still not sure what 'EXPR' should be replaced with, in the
> documentation.
> 
> [same for int,
> 
> =item int EXPR
> X<int> X<integer> X<truncate> X<trunc> X<floor>
> 
> =item int
> 
> Returns the integer portion of EXPR.  If EXPR is omitted, uses C<$_>.
> 
> and presumably this is the same for all unary functions.]
> 
> I find perlfunc unhelpful if it uses EXPR as the mnemonic for
> something
> described as "Keywords related to the control flow of your Perl
> program",
> which for all practical purposes is a statement, given that it can't
> return
> and hence isn't meaningful as part of a larger expression.

$success or exit;


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