ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-web
perl-win32-web
Re: sort ip address
by Kenneth Chan other posts by this author
May 30 2007 2:34PM messages near this date
view in the new Beta List Site
RE: sort ip address | displaying pictures using Perl CGI, apache and Windows
Thanks Bour. This is an excellent way to sort the ip address

Thanks,
Ken

On 5/25/07, Bourgneuf Francois <francois.bourgneuf@[...].fr>  wrote:
> 
>   @ip=('172.27.32.200', '172.19.32.100', '19.1.1.60', '192.20.30.133', '
>  172.27.32.100');
> 
>  print "$_\n" foreach sort {(split '\.', $a)[0]<=>(split '\.',
>  $b)[0]||(split '\.', $a)[1]<=>(split '\.', $b)[1]||(split '\.',
>  $a)[2]<=>(split '\.', $b)[2]||(split '\.', $a)[3]<=>(split '\.', $b)[3]} @
>  ip;
> 
>  19.1.1.60
>  172.19.32.100
>  172.27.32.100
>  172.27.32.200
>  192.20.30.133
> 
>  Bour9
> 
>   ------------------------------
>  *De :* perl-win32-web-bounces@[...].com [mailto:
>  perl-win32-web-bounces@[...].com] *De la part de* Kenneth
>  Chan
>  *Envoy� :* vendredi 25 mai 2007 09:15
>  *� :* perl-win32-web@[...].com
>  *Objet :* sort ip address
> 
>  Hi,
> 
>  Do you have any perl script to sort the IP address?
> 
>  172.27.32.200
>  172.19.32.100
>  10.1.1.60
>  192.20.30.133
> 
>  thanks
> 
> 
>  _______________________________________________
>  Perl-Win32-Web mailing list
>  Perl-Win32-Web@[...].com
>  To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
> 
Thread:
Kenneth Chan
Bourgneuf Francois
Kenneth Chan

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved