Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Monks, your wisdom is required for I am severely lacking any on this Tuesday morning.
Simplest way to sort an array of domain names by their extentions?
my @regexps=('\.co\.uk$','[\w\-]+\.com$','\.pl$','\.uk\.com$'); my @domains=qw(foo.com weirdext.za bar.uk.com blah.co.uk perl.pl zzzz. +co.uk); while(<@regexps>) { while(<@domains>) { if (/$regexp/i) { ......
Ideally I end up with a list of domains in extention order, and any that dont match get tagged on the end, in this case:
blah.co.uk zzzz.co.uk foo.com bar.uk.com perl.pl weirdext.za
Theory 1.003 alpha was to reverse each scalar and sort, but (for ex).coms and .uk.coms would spoil this.
Many thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sorting domains by extention
by demerphq (Chancellor) on Aug 27, 2002 at 10:37 UTC | |
|
Re: sorting domains by extention
by Abigail-II (Bishop) on Aug 27, 2002 at 11:13 UTC | |
|
Re: sorting domains by extention
by BrowserUk (Patriarch) on Aug 27, 2002 at 14:20 UTC | |
by demerphq (Chancellor) on Aug 29, 2002 at 11:58 UTC | |
|
Re: sorting domains by extention
by Aristotle (Chancellor) on Aug 27, 2002 at 11:04 UTC |