#!/usr/bin/perl -w
use strict;
my %fixers=(
'amazon.com' => 'danube.com',
'ibm.com' => 'bm.com',
);
my $text = qq(
Blah one
two
);
sub tweak_links($)
{
my $text_ref = shift;
while( $$text_ref =~ m|"http://(.*?)["/]|g ) {
if( $fixers{$1} ) {
$1 = $main::fixers{$1};
}
}
}
tweak_links(\$text);