in reply to replacing the last portions of an octet
Something like this?
#!/usr/bin/perl -w use strict; my $ips='192.168.1.1-192.168.1.254'; my ($first,$second)=split('-',$ips); printf "%s-%s\n",$first,$second; $first = incip($first); $second = incip($second); printf "%s-%s\n",$first,$second; exit(0); sub incip { my $ip=shift; my @o=split(/[\.]/,$ip); $o[3]++; return sprintf("%d.%d.%d.%d",@o); }
Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: replacing the last portions of an octet
by diamondsandperls (Beadle) on Sep 18, 2012 at 20:06 UTC | |
Re^2: replacing the last portions of an octet
by diamondsandperls (Beadle) on Sep 18, 2012 at 20:03 UTC |
In Section
Seekers of Perl Wisdom