Re: Looking for a Perl module for proper IP sorting

2006-11-13 Thread Sebastian Stumpf
> > 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($_) }

Re: Looking for a Perl module for proper IP sorting

2006-11-13 Thread Sebastian Stumpf
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;

Re: Assigning to a list of variables from a regex

2006-11-11 Thread Sebastian Stumpf
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

Re: how to check the particular perl module is installed or not on unix machine...............

2005-10-01 Thread Sebastian Stumpf
> (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 $@