in reply to Re: Search and replace in an array using data in hash
in thread Search and replace in an array using data in hash

In case the hash doesn't contain the entire possible universe of domain names, you may want to offer a fall back.
use Regexp::Common; s/ ( $RE{net}{IPv4} ) / $hash{$1} || $1 /xge;

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re: Search and replace in an array using data in hash
by Abigail-II (Bishop) on Aug 08, 2003 at 15:39 UTC
    No, you don't want to do that. That makes all your substitutions slower, and it's not necessary. Remember that the files were already scanned for IP numbers, so no unknown IP numbers should be present in the file. If some IP numbers don't resolve, just put a value in the hash that's the same as the key.

    Abigail