use strict; use warnings; my @array = qw/yes no maybe true false false perhaps no/; my %seen; foreach my $string (@array) { next unless $seen{$string}++; print "'$string' is duplicated.\n"; }
产量
@H_403_12@'false' is duplicated. @H_403_12@'no' is duplicated.
@H_403_12@'false' is duplicated.
@H_403_12@'no' is duplicated.