How to implement a search for identical records in a text array (@sgn_str). There are signatures in the array, you need to check that there are no two or more identical signatures in it.
|
4 answers
those. need to remove duplicates?
my @new_list; # массив куда будут помещены "отфильтованные" значения my @list ; #исходный массив my %seen; #хеш для работы @new_list = grep {$_ && !$seen{$_}++} @list ; - Not! It is necessary to check if there are identical records in it! If there is a repetition, then not all the signatures are collected ... Although .. Then you can compare the number of records in the new and old array. If it is the same, then there are no duplicates !!! - Vitaly Vladimirov
|
use List::MoreUtils "uniq";my @unique = uniq @all ; |