in reply to Replace after match in regex (key value subsitution)
#!/usr/bin/perl -w use strict; my %fixers=( 'amazon.com' => 'danube.com', 'ibm.com' => 'bm.com', ); my $text = qq( Blah <a href="http://amazon.com/foo">one</a> <a href="http://ebay.com/foo">two</a> ); map { $text =~ s/$_/$fixers{$_}/; }keys %fixers; print $text;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replace after match in regex (key value subsitution)
by ikegami (Patriarch) on Oct 23, 2008 at 04:28 UTC |