#!/usr/bin/perl --
use strict;
use warnings;
use Net::CIDR qw/ cidr2octets /;
while(<STDIN>){
s{\s+$}{}; ## trim
print "$_\n" for cidr2octets( $_ );
}
__END__
$ echo dead::beef::/46 | perl cidr2octets.pl
dead:beef:0000
dead:beef:0001
dead:beef:0002
dead:beef:0003
| [reply] [d/l] |
#!/usr/bin/perl -w
use Modern::Perl;
use Net::CIDR qw/ cidr2octets /;
while(<STDIN>){
s{\s+$}{};
print "$_\n" for cidr2octets($_);
}
__END__
Which allows me to
$ unpack-cidr.pl < packed-cidr > unpacked-cidr
Once again, I'm really grateful for your taking the time to respond with the illusive logic I was seeking. This is all part of a much larger process, and this missing piece of the puzzle was just what I needed to put it all together. I'll post it all here, when I've completed it. As I suspect others will also gain from it.
Thanks again!
¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH
| [reply] [d/l] [select] |
Well. I actually tried an example from another script I created to strip ANSI sequences from (type)script output
binmode STDIN, ":raw:eol(LF)";
while (<STDIN>) {
s/\033[^m]*m//g;
print $_;
But I found my problem seems to stem from how to implement it -- plug it into what I have working with Net::CIDR. As shown in my OP example.
¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH
| [reply] [d/l] |
Well. I actually tried an example from another script I created to strip ANSI sequences from (type)script output But I found my problem seems to stem from how to implement it -- plug it into what I have working with Net::CIDR. As shown in my OP example. What?
You don't show sample input, and you say there is a problem with the program, <STDIN> doesn't work in some way
Well, use dd() to dump the data and show the data here on perlmonks
| [reply] [d/l] |
No. Your pointers were helpful. I'm getting closer. My only (attempted) point was that;
while I have some working experience using STDIN. I'm having a hellofatime applying it to what I'm working with now.
Thanks for the tips! They've jogged my thoughts just enough to get me in the correct direction.
¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH
| [reply] |