in reply to Deleting paragraphs based on match in a hash

What I think you are trying to do is these steps:

So, what this means in code:

while(<>) { if(/^PORNUM:\s*(\S+)/m) { if(exists $skip{$1}) { # It matches, and ought to be skipped next; } } print; }

That doesn't look too bad, does it? (And it can be reduced a lot more, at the cost of readability for beginners. But IMHO, it's worth it.)

All you still have to do, is initialize the %skip hash first, for example, like this:

my %skip = map { $_ => 1 } qw(PP22x43@.5 PC12x120/25);

Alternatively, you can read data from a string or from the DATA section (or even from an external file), and split on whitespace.

p.s. The reduced code that I talked about, can be something like this:

while(<>) { next if /^PORNUM:\s*(\S+)/m and exists $skip{$1}; print; }

Update: Oh, now I see: you put in the format for an "exclude" file. well, you'll have to read that first.

while(<EXCLUDE>) { if(/^PORNUM:\s*(\S+)/) { $skip{$1} = 1; } }