in reply to Deleting paragraphs based on match in a hash
Problems and changes:
#!/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 (<DATA>) { 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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Deleting paragraphs based on match in a hash
by Anonymous Monk on Sep 03, 2009 at 23:57 UTC |