open RH, $ARGV[0];
%dict = ();while(<RH>){ chomp; $ln = $_; if($dict{$ln}){ $dict{$ln} ++; }else{ $dict{$ln} = 1; } }while(($k,$v) = each %dict){ print $k ."\t" . $v. "\n";}
close RH;
uniq.pl
原文:http://my.oschina.net/xiechaoyong/blog/362203