Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Merge CIDRs

by merlyn (Sage)
on Oct 13, 2001 at 05:24 UTC ( #118616=note: print w/replies, xml ) Need Help??


in reply to Re: Merge CIDRs
in thread Merge CIDRs

1 while s/^(\d*)0\n\1.$/$1/mg || s/^(\d*)\n\1.*$/$1/mg;
There's a reason I put [1] there instead of your ".". Consider what happens when you have the following:
10010 100100 100101
The last two lines will be merged, creating
10010 10010
And your code will strip that final 0 from both lines, creating "1001". Wrong. You must ensure that it's a 1. Can't be "any".

-- Randal L. Schwartz, Perl hacker

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2020-01-25 14:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?