http://www.perlmonks.org?node_id=604564


in reply to Re^5: Search and delete lines based on string matching
in thread Search and delete lines based on string matching

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^7: Search and delete lines based on string matching
by imp (Priest) on Mar 13, 2007 at 15:17 UTC
    For deletion you would use this pattern, sorry:
    while (my $line = <$pattern_fh>) { chomp $line; # Use quotemeta to allow for items like A[0] push @tokens, quotemeta($line); } my $pattern = '^(?:' . join('|', @tokens) . ')[^a-zA-Z]*$'; print "Search pattern: $pattern\n";