直接上代码
my @array = ( ‘a‘, ‘b‘, ‘c‘, ‘a‘, ‘d‘, 1, 2, 5, 1, 5 ); my %count; my @uniq_times = grep { ++$count{ $_ } < 2; } @array;
时间: 2024-10-04 03:10:22
直接上代码
my @array = ( ‘a‘, ‘b‘, ‘c‘, ‘a‘, ‘d‘, 1, 2, 5, 1, 5 ); my %count; my @uniq_times = grep { ++$count{ $_ } < 2; } @array;