develooper Front page | perl.perl5.porters | Postings from July 2014

Maps and Signatures

Thread Next
From:
Alberto Simões
Date:
July 18, 2014 13:03
Subject:
Maps and Signatures
Message ID:
53C91AFB.2070001@alfarrabio.di.uminho.pt
Hello

Not sure if this was already discussed. If so, sorry my noise.

Would it be possible to make map (and grep) to have a signature, in 
order to say which variable will be used instead of $_?

Not though much on the syntax, but something like

    @squares = map sub($a){ $a**2 } (1..10);

This would be handy for functional guys, that uses a lot of maps inside 
maps.

Cheers
ambs

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