Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: ordering array of sentences

by kennethk (Monsignor)
on Nov 13, 2012 at 16:11 UTC ( #1003649=note: print w/ replies, xml ) Need Help??


in reply to ordering array of sentences

This definitely sounds like a job for regular expressions. You should be able to grab the word to the left of searching Using character classes, specifically \S, which "represents any non-whitespace character". You can then use that to write your own sorting routine, as described in sort. Don't forget that cmp is case sensitive, so you may want to use lc in your comparison.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re: ordering array of sentences
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003649]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2014-07-26 18:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (178 votes), past polls