applebananapearcarrotcarrotbeardeerdeer goatcowduckswanchickenmouseratbirdmouse chocolatedogdogfishmousecatdeerbird newyorkcalifornianewjerseymousecatdeerbird #### monksbicyclewindbikecars computercomputerprinters hellicopterairplaneshelf chocolatedogdogfishmouse printerprintermousecouch . . goes on for another 600,000 lines #### #!/usr/bin/perl -w use strict; my %lines; my %lines2; my $str2; open(UNIQUES,"<$ARGV[0]"); open(ALL, "<$ARGV[1]"); while () { $lines{$str1} = 1; } while () { print $str1 if substr( $str1, 0, 24) eq ($str2); next ($str2); }