Dear monks,
as this part takes ~15% of an fast alignment algorithm, it would be nice to have a faster way.
my $Y = [ qw( a b a) ]; my $YPos; my $index; for ( $index = 0 ; $index <= $#$Y ; $index++ ) { push ( @{ $YPos->{$Y->[$index]} }, $index ); } # now $YPos should contain my $result = { a => [ 0, 2 ], b => [ 1 ], };
TIA (Thanks In Advance)
Helmut Wollmersdorfer
In reply to Faster indexing an array by wollmers
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |