#!/usr/bin/perl # http://perlmonks.org/?node_id=1208637 use strict; use warnings; use Inline::Files; my %replace = map /^(\S+)\s+(\S.*)$/, ; while( ) { s#\bRef\d+# $replace{$&} // $& #ge; print; } __LOOKUP__ Ref00004 https://dealerportal4.xx.com/siteminderagent/forms/xx.fcc;ACS=0 Ref00005 https://sso.xx.com/siteminderagent/forms/xx.fcc;ACS=0;REL=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;ACS=0;REL=0 __MASTER__ false TCP portal auth scheme 5 false Ref00005