Try something like this:
c:\@Work\Perl\monks\lewars>perl -wMstrict -le "use Data::Dump qw(dd); ;; my $xlate_file = 'lookup.dat'; open my $fh_xlate, '<', $xlate_file or die qq{opening '$xlate_file': +$!}; ;; my %xlate = map { m{ \A (\S+) \s+ (.+?) \s+ \z }xms } <$fh_xlate> ; dd \%xlate; close $fh_xlate or die qq{closing '$xlate_file': $!}; ;; my ($rx_ref) = map qr{ \b (?: $_) \b }xms, join ' | ', map quotemeta, reverse sort keys %xlate ; print $rx_ref; ;; my $master_file = 'master.dat'; open my $fh_master, '<', $master_file or die qq{opening '$master_file +': $!}; ;; my $master = do { local $/; <$fh_master> }; close $fh_master or die qq{closing '$master_file': $!}; ;; $master =~ s{ ($rx_ref) }{$xlate{$1}}xmsg; print qq{[[$master]]}; " { Ref00004 => "https://dealerportal4.xx.com/siteminderagent/forms/xx.f +cc;ACS=0", Ref00005 => "https://sso.xx.com/siteminderagent/forms/xx.fcc;ACS=0;R +EL=0", Ref00006 => "https://secure3.xx.com/siteminderagent/forms/xx.fcc;ACS +=0;REL=0", Ref00007 => "https:///siteminderagent/cert/smgetcred.scc?cert", Ref00008 => "https://secure4.xx.com/siteminderagent/forms/xx.fcc;ACS +=0;REL=0", Ref00009 => "https://vbos-uat.xx.com/siteminderagent/forms/xx.fcc;AC +S=0;REL=0", } (?msx-i: \b (?: Ref00009 | Ref00008 | Ref00007 | Ref00006 | Ref00005 | + Ref00004) \b ) [[<Property Name="CA.SM::AuthScheme.IsUsedbyAdmin"> <BooleanValue>false</BooleanValue> </Property> <Property Name="CA.SM::AuthScheme.Desc"> <StringValue>TCP portal auth scheme</StringValue> </Property> <Property Name="CA.SM::AuthScheme.Level"> <NumberValue>5</NumberValue> </Property> <Property Name="CA.SM::AuthScheme.IsTemplate"> <BooleanValue>false</BooleanValue> </Property> <Property Name="CA.SM::AuthScheme.Param"> <LinkValue><XREF>https://sso.xx.com/siteminderagent/forms/xx.fcc;A +CS=0;REL=0</XREF></LinkValue> </Property> <Property Name="CA.SM::AuthScheme.Library"> ]]
Update: For a good discussion of the technique used above to build the $rx_ref regex matching object, see Building Regex Alternations Dynamically by haukex.
Give a man a fish: <%-{-{-{-<
In reply to Re: Replace string in one file using input from another file
by AnomalousMonk
in thread Replace string in one file using input from another file
by lewars
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |