Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: ordering array of sentences

by welle (Beadle)
on Nov 13, 2012 at 19:24 UTC ( #1003690=note: print w/ replies, xml ) Need Help??


in reply to Re^3: ordering array of sentences
in thread ordering array of sentences

What if my @sentences has a more complicated structure? I get @sentences from querying a Sqlite database with the following:

$sentences = $dbh->selectall_arrayref("SELECT ID, sentence FROM texts +WHERE sentence REGEXP '(?i:$query)'");

As one can see, the result is made of two elements (ID and sentence). How can I read/manipulate in the code provided by choroba only the second element "sentence", preserving at the end of the sorting operation the same structure ID/sentence?


Comment on Re^4: ordering array of sentences
Download Code
Re^5: ordering array of sentences
by afoken (Prior) on Nov 14, 2012 at 06:18 UTC
    1. use ORDER BY in SQL to have the data delivered to perl in the expected order
    2. Schwartzian transform

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2015-07-03 22:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls