Here's another option:
use Modern::Perl; my $IPs = '192.168.1.1-192.168.1.254'; $IPs =~ s/(.+\.)(\d+)(\s*-\s*.+\.)(\d+)/$1 . ($2 - 1) . $3 . ($4 + 1)/ +e; say $IPs;
Output:
192.168.1.0-192.168.1.255
In reply to Re: replacing the last portions of an octet
by Kenosis
in thread replacing the last portions of an octet
by diamondsandperls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |