I was surprised to find that the keys function happily works with arrays:
keys HASH keys ARRAY keys EXPR
Returns a list of all keys in a named hash, or array indexes. (In a scalar context, returns the number of keys or indexes.)
Is there any use to using keys @array instead of 0 .. $#array in terms of memory usage, speed, etc., or reasons why this functionality is more of a historical origin?
When I see that keys @array supports the modification of $[ , I assume that it is historical:
$ perl -Mstrict -wE 'local $[=4; my @array="a".."z"; say join ",", keys @array;' Use of assignment to $[ is deprecated at -e line 1. 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29