Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Sort text by Chapter names

by Your Mother (Archbishop)
on May 24, 2018 at 05:36 UTC ( [id://1215129]=note: print w/replies, xml ) Need Help??


in reply to Sort text by Chapter names

Most definitely possible. It sounds like homework though. Have you tried writing any code?

A successful approach is going to collect/match/parse the data into blocks of chapter + its text in an array, or an array of hashes, and then use the chapter in a sort block. You can search here or online for multi-line matching and sorting. If you show some code, you'll most definitely get help with improving it.

Replies are listed 'Best First'.
Re^2: Sort text by Chapter names
by Bman70 (Acolyte) on May 24, 2018 at 20:57 UTC

    Thanks all! Haha it's in no way homework.. just a problem I created for myself when I used a hash to get the chapter data, resulting in the chapters always returning in a different order (since hashes aren't ordered).

    So I want to get the chapters, then sort them. But I may have found a way to use an ARRAY OF HASHES, to avoid having to do this!

    I'll ponder over all the answers though so I can have this option if necessary.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 22:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found