open (FILE, "userstab.txt") || die "Cannot open file.\n"; open (NEWFILE, ">results.txt") || die "Cannot find or open file for editing.\n"; while () { @zapschool = split (/\t/); if (m/zaps/i) { print NEWFILE "$zapschool[4]\n"; } } close FILE; close NEWFILE;