develooper Front page | perl.perl5.porters | Postings from June 2008

Re: [perl #56150] return return

Thread Previous
From:
Aristotle Pagaltzis
Date:
June 20, 2008 09:06
Subject:
Re: [perl #56150] return return
Message ID:
20080620160556.GW25433@klangraum.plasmasturm.org
* Nicholas Clark <perlbug-followup@perl.org> [2008-06-20 18:00]:
> $ ./perl -Ilib -e 'sub foo {return return}'
> $
> 
> How come this isn't a syntax error?

Because `return` is a function, not a statement, presumably so
you can write the following?

    sub process_file {
        # ...
        open my $fh, '<', $fn or return;
        # ...
    }

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hack;
#Aristotle Pagaltzis // <http://plasmasturm.org/>

Thread Previous


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