Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
OK. I've been struggling with this long enough. I'm going to have to ask for help...

I'm working (manipulating) a list of IP addresses. I have been largely doing this manually, which is stupid. So now that I've finally got to the point that the list is large enough that I have to deal with it in some (at least somewhat) automated fashion. I'm looking to Perl to save the day.

The finished list is packed in CIDR form. I unpack the address block I need to modify, then repack, and re-insert the (modified) block back into the list.

I looked at several nodes here, including (tye)Re2: Net::CIDR::Lite ?? (Merge CIDR addresses). But wasn't sure how to apply it to my needs. So I eventually settled on Net::CIDR. I've managed unpacking the list, with an array. But what I'm trying to do, is feed the list to the script

# unpackcidr < packed-list > unpacked-list

Here's what I have so far. But it requires me to paste the list between the paren's
#!/usr/bin/perl use Net::CIDR; use Net::CIDR ':all'; print join("\n", Net::CIDR::cidr2octets( # here's where I've tried <STDIN> && $_ but to no avail )) . "\n";
Inserting a list of quoted IP addresses in CIDR notation works in there. But that's not what I'm hoping for. I know this is dead simple stuff. But I'm apparently in dimwit mode ATM. :P

Thanks for anything that might help.

λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

In reply to Redirection problem / question by taint

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2022-08-09 19:21 GMT
Find Nodes?
    Voting Booth?

    No recent polls found