> > Please sort the IP addresses with this way could help you,
> >
> > @list = sort { $b <=> $a } @ip_addresses;
> Wouldn't this do the same kind of sort I've been doing (aka a textual
> one)?
No, I don't think so.
> perl -MSocket -wle 'print for map { inet_ntoa($_) } sort map
> { inet_aton($_) }
On Mon, 13 Nov 2006 14:38:25 +0100
"Roman Daszczyszak" <[EMAIL PROTECTED]> wrote:
> Is there a Perl module that does proper IP sorting?
I think you could use NetAddr::IP for that job. Or something simpler
like that:
use Socket;
@sorted = map { inet_ntoa($_) } sort map { inet_aton($_) } @unsorted;
On Sat, 11 Nov 2006 17:11:45 +
Nigel Peck <[EMAIL PROTECTED]> wrote:
> my ( $val1, $val2 ) = $data =~ /^([^:]+):([^:]+)$/
> || die 'Failed to parse data';
Just use brackets around the regexp:
my ($val1, $val2) = ($data =~ //);
die unless $val1 && $val2;
Greetings
Sebastian
--
VI VI VI
> (Here on perl-beginners, I think non-LOL English is the preferred
> dialect.)
ACK
If you want to run your checks from a perl script, you will need to eval
the code. You could try something like this:
BEGIN {
eval('use ModuleName');
die "You need to install ModuleName...\n" if $@