hi consider the script below. it counts every single occurence of a search pattern in a txt file. i want to count how many times a certain pattern appears in a very large file (100.000 lines for instance). macperl will run out of memory, so i thought there might be a faster way ... thanks allan --- #!/usr/bin/perl -w $inputfile = "input.txt"; my $count = 0; my $search = 'html'; open (INPUT, $inputfile); {local $/;$string = <INPUT>;} while ($string =~ /$search/g) { $count++; } print "found $count occurences of: $search";