Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: replacing the last portions of an octet

by Kenosis (Priest)
on Sep 18, 2012 at 20:14 UTC ( #994352=note: print w/ replies, xml ) Need Help??


in reply to replacing the last portions of an octet

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


Comment on Re: replacing the last portions of an octet
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994352]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (15)
As of 2014-08-29 14:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (280 votes), past polls