#!/usr/bin/env perl # if you're on jones, use this version: chdir "/Volumes/Data/Corpora/en/brown/"; # if you've mapped the network drive, uncomment this line (and comment # out the previous one): #chdir "/Volumes/Corpora/en/brown/"; @all_files = <*>; $to_counter = 0; foreach (@all_files) { $file_name = $_; open FILE, '<', $file_name; $index = 1; while () { chomp; if (m{\bneed/vb\s+\bto/}) { ++$to_counter; print "File: $file_name\n"; print "Line number: $index\n"; print "$_\n\n"; } $index++; } }