Hello

Your columns are kind of consistent:

my @unordered = ( '12 Corinthians 5:10', 'Hebrews 11:15', '1 Corinthians 13:23', '2 Corinthians 1:3', 'John 3:16', '1 Corinthians 12:10', '1 Corinthians 2:10', '1 Corinthians 2:10' );
Basically, all your lines match
/^(\d+ )?(\D+) (\d+):(\d+)$/.
Here is how it can be done assuming you want to sort by the first number, then by the word, then by the number before the ':', then finally by the number after the ':'.
#!/usr/bin/perl -w my @unordered = ( '12 Corinthians 5:10', 'Hebrews 11:15', '1 Corinthians 13:23', '2 Corinthians 1:3', 'John 3:16', '1 Corinthians 12:10', '1 Corinthians 2:10', '1 Corinthians 2:10' ); my @sorted = map { $_->[0] } sort { ($a->[1]||0) <=> ($b->[1]||0) || $a->[2] cmp $b->[2] || $a->[3] <=> $b->[3] || $a->[4] <=> $b->[4] } map { [$_, /^(\d+ )?([A-Za-z]+) (\d+):(\d+)$/] } @unordered; print "$_\n" for @sorted; # Hebrews 11:15 # John 3:16 # 1 Corinthians 2:10 # 1 Corinthians 2:10 # 1 Corinthians 12:10 # 1 Corinthians 13:23 # 2 Corinthians 1:3 # 12 Corinthians 5:10
Hope this helps,,,

Aziz,,,


In reply to Re: Inconsistent column Schwartzian Transform attempt by abstracts
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.