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

last inside map

Thread Next
From:
H.Merijn Brand
Date:
October 16, 2011 23:33
Subject:
last inside map
Message ID:
20111017083311.05a5d53f@pc09.procura.nl
Currently, last inside map is invalid:

$ perl -wE'my@x=map{$_>10&&last;$_}1..100;say$#x'
Can't "last" outside a loop block at -e line 1.

What about making that a stop-now-fast to mimic lazy-lists (if
possible)?

$ perl -wE'my@x=map{$_>10&&last;$_}1..100;say$#x'
10

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

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