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.