magento
asked on
Perl sort
Hi ,
I have a list of domain names which need to be sorted based on the topdomain name ( .com,.co.uk,.org etc)
So in the below it was sorted in the format - cc,co.uk,com,net,org
Input:
google.com
yahoo.com
something.net
pbs.org
enduranceinternational.com
google.co.uk
www.pbs.org
store.pbs.org
nicoleg.cc
-------------------------- ---------- ---------- --------
output:
nicoleg.cc
google.co.uk
enduranceinternational.com
google.com
yahoo.com
something.net
pbs.org
store.pbs.org
www.pbs.org
Thanks,
Magento
I have a list of domain names which need to be sorted based on the topdomain name ( .com,.co.uk,.org etc)
So in the below it was sorted in the format - cc,co.uk,com,net,org
Input:
google.com
yahoo.com
something.net
pbs.org
enduranceinternational.com
google.co.uk
www.pbs.org
store.pbs.org
nicoleg.cc
--------------------------
output:
nicoleg.cc
google.co.uk
enduranceinternational.com
google.com
yahoo.com
something.net
pbs.org
store.pbs.org
www.pbs.org
Thanks,
Magento
How do you want to specify or determine what the top domains are? It's not possible to do this without some way of knowing what the "top domains" are (for instance, I would have said uk was the top domain (not co.uk).
ASKER
Hi,
Yes, i understand.
But in the example i state co.uk is the top domain and not uk.
Is it possible to code using the i/p and o/p?
Thanks
Yes, i understand.
But in the example i state co.uk is the top domain and not uk.
Is it possible to code using the i/p and o/p?
Thanks
Are the top domains in your example the only ones we need to worry about? If not, how do we know when you want the last component or the last two (or more) components of the domain name?
What do you mean by i/p and o/p? I'm not familiar with those terms.
What do you mean by i/p and o/p? I'm not familiar with those terms.
ASKER
I am sorry .
i/o and o/p means input and output respectively.
This is just for my learning so only the given examples is enough to work with .
Thanks
i/o and o/p means input and output respectively.
This is just for my learning so only the given examples is enough to work with .
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Very helpful , thank you .