http://qs1969.pair.com?node_id=1125183

taint has asked for the wisdom of the Perl Monks concerning the following question:

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