in reply to Loops in Perl

that's a list assignment to an array slice on the LHS.

> Is it shorthand for a foreach loop?

ehm ... well the effect is analogous to many scalar assignments

$ranks[ $sorted_positions[$_] ] = $_ for 0 .. $#sorted_positions

but actually it's an assignment of list to list

> Does perl increment the index for both arrays automatically?

there is no increment after the range operator created a list on the RHS.

Cheers Rolf

( addicted to the Perl Programming Language)