# Code to load serial numbers into @serials goes here... while (<>) { for my $serial (@serials) { if (0 >= index($_, $serial) { print $_; next; } } }