##
my @indexes = grep { condition($elements[$_]) } 0..$#elements;
####
my @filtered;
for (@elements) { # Not any list, an array specifically.
push @filtered, $_ if condition($_);
}
####
my @indexes;
for (0..$#elements) {
push @indexes, $_ if condition($elements[$_]);
}