taint has asked for the wisdom of the Perl Monks concerning the following question:
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
Here's what I have so far. But it requires me to paste the list between the paren's# unpackcidr < packed-list > unpacked-list
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#!/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";
Thanks for anything that might help.
¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH
|Replies are listed 'Best First'.|
Re: Redirection problem / question
by Anonymous Monk on Apr 30, 2015 at 01:15 UTC