use warnings; use strict; use List::MoreUtils qw(indexes); my @array = qw("this" "xxx" "is" not "xxx" and "xxx" "whatever"); my @indexes = indexes { /xxx/ } @array; print @indexes;