in reply to Multiple Search and Replaces on one file

Two suggestions -- one is to restructure the hash search and replace a little for less iterations, and the other is to split on "WARNING" instead of just matching, so you can work on the pieces separately.
my $keysForRE = join '|', keys %date_hash; while(<FILE>){ s/\b($keysForRE)\b/$date_hash{$1}/eg; my ($piece1, $piece2) = split /\bWARNING\b/, $_, 2; # do stuff to $piece1 # do stuff to $piece2 $_ = join 'WARNING', ($piece1, $piece2); }

Replies are listed 'Best First'.
Re^2: Multiple Search and Replaces on one file
by Elijah (Hermit) on Jun 15, 2005 at 15:38 UTC
    The OP wants to completely remove everything up to WARNING so your join() would not be neccessary.