in reply to Re: grep { } positional number of element
in thread grep { } positional number of element

Or, if you are running the latest version of Perl, v5.36, you could go experimental and use the new for list and indexed function>
use v5.36; use builtin qw/indexed/; no warnings q/experimental::builtin/; no warnings q/experimental::for_list/; my @array = ( "Alfa","beta","gamma"); for my ($index, $element) (indexed @array) { print "$index => $element\n"; }
(Incidentally, is there any difference between indexed(@array) and each(@array)?)