I am looking for the Perl equivalent for the following PHP code: -
foreach($array as $key => $value){ ... }
I know I can make a foreach loop like this: -
foreach my $array_value (@array){ .. }
Which will allow me to do something with array values, but I would also like to use keys.
I know there is a Perl hash that allows you to set key-value pairs, but I just need the index number, which automatically gives you an array.
source share