in reply to perl functionality like unix's "sort -u" and "uniq -c"

sort -u is pretty much
my %hash = map {($_ => undef)} <>; print sort keys %hash;
and uniq -c is pretty much
my $prev=<>; my $count=1; while (<>) { if ($prev eq $_) { $count++ } else { printf "%4d %s", $count, $prev; $count = 1; $prev = $_; } } printf "%4d %s", $count, $prev;
More complete implementations of Unix tools in Perl are available from CPAN as PPT::Util.

Caution: Contents may have been coded under pressure.