[Omaha.pm] what kind of construct is (_) ?

Jay Hannah jay at jays.net
Wed Jan 30 05:03:56 PST 2008


hanging out in irc.perl.org #catalyst this morning...

:)

j


06:57 <@mst> print join(', ', [ 1, 2, 3 ]->map(f (_) { $_+1 })->grep 
(f (_) { $_ % 2 == 0 }));
06:57 <@mst> that should print 2, 4
06:58 <@mst> jhannah: that the sort of thing powershell does with pipes?
06:58 <@ash> mst: you're insane. go write some haskel
06:58 < jhannah> mst: sorry, I'm lost
06:59 < jhannah> you see, the Internet is a series of tubes...
07:00 <@marcus> agree, mst is insane
07:01 <@marcus> what kind of construct is (_) ?
07:01 <@mst> marcus: equiv. to "sub { my $_ = shift; ... }"
07:01 <@mst> was introduced in 5.8.8
07:01 <@mst> sub (_)
07:01 < jhannah> off to CHEM lecture! whee!!!!        (someone,  
PLEASE -- shoot me!)
07:01 <@mst> I just used 'f' because I can make that work and it  
seemed more elegant
07:02 <@ash> mst: it was?
07:02 <@mst> yes.




More information about the Omaha-pm mailing list