#! perl -slw use 5.010; use strict; use Time::HiRes qw[ time ];; sub uniq{ my %uniq; undef @uniq{ @_ }; keys %uniq } my @lines; for ( 1 .. 1e3 ) { my $line = int( rand 1e6 ); $line .= chr(9) . int( rand 1e6 ) while length( $line ) < 4096; push @lines, $line; } my $start = time; $_ = join chr(9), uniq( split chr(9), $_ ) for @lines; my $stop = time; printf "On random 4k lines, uniquing averaged %.6f seconds/line\n", ($stop - $start) / 1e3; __END__ c:\test>junk On random 4k lines, uniquing averaged 0.000695 seconds/line c:\test>junk On random 4k lines, uniquing averaged 0.000696 seconds/line c:\test>junk On random 4k lines, uniquing averaged 0.000712 seconds/line c:\test>junk On random 4k lines, uniquing averaged 0.000700 seconds/line