in reply to Multiple Search and Replaces on one file
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 |