On Wed, 2 May 2001 08:05:29 -0700 (PDT), Larry Wall <[EMAIL PROTECTED]> wrote:
> Michael G Schwern writes:
> : (grep {...} @stuff)[0] will work, but its inelegant.
> 
> It's inelegant only because the slice doesn't know how to tell the
> iterator it only needs one value.  If it did know, you'd call it
> elegant.  :-)

IIRC, that optimization is not even considered for reasons of many people
wanting the side effects of grep/map finishing over all elements (which could
of course be from a tied array or database connection)

-- 
H.Merijn Brand    Amsterdam Perl Mongers (http://www.amsterdam.pm.org/)
using perl-5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
     WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/

Reply via email to