my $tsv_data; # Slurp the file { local $/ = undef; local *BIGFILE; open BIGFILE, "<$tsv_data" or die "can't open big file. $!"; $tsv_data = ; close BIGFILE or die "Can't close big file: $!"; } # Throw it all in an array for testing my @records = split /\n/, $tsv_data; # Opps need the line feeds back again for the output files @records = map { "$_\n" } @records; my @london = grep /LONDON/, @records; # Write to new file, amend old file.. ...