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 Bourgneuf Francois other posts by this author
May 25 2007 12:55AM messages near this date
view in the new Beta List Site
sort ip address | Re: sort ip address
@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
	
Thread:
Kenneth Chan
Bourgneuf Francois
Kenneth Chan

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