my @idx = map /(id\d+)/, @items; #### my @idx; /(id\d+)/ && push @idx, $1 for @items;