#!/usr/bin/perl use strict; use warnings; my @rawdata; { my $file = 'rawdata.txt'; open my $fh, '<', $file or die "can't open $file to read: $!"; @rawdata = <$fh>; close $fh; } my @exceptions; { my $file = 'exceptions.txt'; open my $fh, '<', $file or die "can't open $file to read: $!"; @exceptions = <$fh>; close $fh; } # crunch the data my @exceptions_found; my @exceptions_counted; { my $file = 'exceptions_found.txt'; open my $fh, '>', $file or die "can't open $file to write: $!"; print $fh "$_\n" for @exceptions_found; close $fh; } { my $file = 'exceptions_counted.txt'; open my $fh, '>', $file or die "can't open $file to write: $!"; print $fh "$_\n" for @exceptions_counted; close $fh; }