use warnings; use strict; use List::MoreUtils qw(firstidx); my @list = (1, 4, 3, 2, 4, 6); printf "item with index %i in list is 4\n", firstidx { $_ == 4 } @list; __END__ item with index 1 in list is 4