in reply to Masking IPs

Add /g:
if (/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/){ s/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/xxx.xxx.xxx.xxx/g; print VPNOUTFILE "$_"; }

The original and the above are redundant, though. You could simply use:

if (s/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/xxx.xxx.xxx.xxx/g) { print VPNOUTFILE "$_"; }

Are you sure you need to specify \d{1,3}? The following is somewhat easier to read:

if (s/\d+\.\d+\.\d+\.\d+/xxx.xxx.xxx.xxx/g) { print VPNOUTFILE "$_"; }

Replies are listed 'Best First'.
Re^2: Masking IPs
by kaif (Friar) on Jun 29, 2005 at 00:09 UTC

    The /g is what the OP wanted. But for the pattern, even better, use a well-crafted regex for IP addresses:

    use Regexp::Common qw(net); print VPNOUTFILE if s/$RE{net}{IPv4}/xxx.xxx.xxx.xxx/g;