I have absolutely no idea what you're doing in your sort. I'm assuming that you want to sort on the following (in order):
  1. Book name
  2. Chapter
  3. Verse
In that case, you don't want to do a split, but, rather, a regex.
map { [ $_, /(?:(\d+)\s+)?(\w)\s+(\d+):(\d+)/ ] }
Then, in your sort, you now compare in the following:
sort { $a->[2] cmp $b->[2] || ( defined $a->[1] && defined $b->[1] && $a->[1] <=> $b->[1]) || $a->[2] <=> $b->[2] || $a->[3] <=> $b->[3] }
The reason for both defined checks is that you need to make sure that both sides have a number. You might have '1 Hebrews' vs. 'Hebrews'. You don't want to try and make that comparison. If you wanted, you could fake 'Hebrews' into '0 Hebrews' by improving the sort a bit to say
sort { $a->[2] cmp $b->[2] || ($a->[1] || 0) <=> ($b->[1] || 0) || $a->[2] <=> $b->[2] || $a->[3] <=> $b->[3] }
Putting it all together, you end up with:
@sorted = map { $_-[0] } sort { $a->[2] cmp $b->[2] || ($a->[1] || 0) <=> ($b->[1] || 0) || $a->[2] <=> $b->[2] || $a->[3] <=> $b->[3] } map { [ $_, /(?:(\d+)\s+)?(\w)\s+(\d+):(\d+)/ ] } @unsorted;
(Note - this is untested code. Caveat Emptor!)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.


In reply to Re: Inconsistent column Schwartzian Transform attempt by dragonchild
in thread Inconsistent column Schwartzian Transform attempt by gryphon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.