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'
);
####
/^(\d+ )?(\D+) (\d+):(\d+)$/.
####
#!/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