#!/usr/bin/perl use strict; use warnings; my %skip; my $file = shift; open(my $list, '<', $file) or die; while(<$list>) { chomp; next if /^$/; #skip blank lines in hash file #assumes that hash file is just the ID, without umPORN prefix $skip{ $_ }=1; } close($list); { local($/)=""; while () { next if ( m/ PORNUM: \s+ (.*) $ /mx && $skip{ $1 } ); print "-$_-"; } } __DATA__ random lines of data PORNUM: PC21x21!2 random lines of data random lines of data random lines of data PORNUM: PP22x43@.5 random lines of data PORNUM: PP12x60@1 random lines of data random lines of data random lines of data PORNUM: PC12x120/25