welle has asked for the wisdom of the Perl Monks concerning the following question:
I have an array (@sentences) containing sentences, for example
I am searching for a word What are you searching for? Today I have been searching for a new job
I would like to sort them alphabetically according to the word on the left side of the word @query="searching". The sorted order would be:
I am searching for a word Today I have been searching for a new job What are you searching for?
Any ideas how to get started? I am really stuck... I guess, I should use split (\s), maybe map or index, and of course cmp. But I have really no idea how to start...So, any idea would be appreciated
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: ordering array of sentences
by choroba (Cardinal) on Nov 13, 2012 at 16:15 UTC | |
by kennethk (Abbot) on Nov 13, 2012 at 16:26 UTC | |
by welle (Beadle) on Nov 13, 2012 at 16:52 UTC | |
by choroba (Cardinal) on Nov 13, 2012 at 16:58 UTC | |
by welle (Beadle) on Nov 13, 2012 at 17:51 UTC | |
by welle (Beadle) on Nov 13, 2012 at 19:24 UTC | |
by afoken (Chancellor) on Nov 14, 2012 at 06:18 UTC | |
by welle (Beadle) on Nov 13, 2012 at 19:27 UTC | |
Re: ordering array of sentences
by kennethk (Abbot) on Nov 13, 2012 at 16:11 UTC | |
Re: ordering array of sentences
by Anonymous Monk on Nov 13, 2012 at 16:08 UTC |
Back to
Seekers of Perl Wisdom