in reply to Re^2: Handling variable column position
in thread Handling variable column position
Is there a way to do this without using a non-core module?
Update: Added required ->'s per choroba's offline observation. (Many thanks!)
You could write your own:
sub firstidx(&@) { my $code = shift; $code->( $_[ $_ ] ) and return $_ for 0 .. $#_; }
But it won't be as fast as the (XS) module.
A possibly better version::
sub firstidx(&@) { my $code = shift; $code->( local $_ = $_[ $_ ] ) and return $_ for 0 .. $#_; }
|
|---|