I ran the solution proposed by kyle against my corpus of documents and I found another exception.
If you run only "section 1" with the below data input, the solution proposed by kyle will introduce the improper behavior of the subroutine, while the original version will work ok.
my $st5 = 'PASAI OUN AI GENEAI APO ABRAAM EWS DABID GENEAI DEKATESSARE +S KAI APO DABID EWS THS METOIKESIAS BABULWNOS GENEAI DEKATESSARES KAI + APO THS METOIKESIAS BABULWNOS EWS TOU XRISTOU GENEAI DEKATESSARES'; my $st6 = 'PASAI OUN AI GENEAI APO ABRAAM EWS DAUID GENEAI DEKATESSARE +S KAI APO DAUID EWS THS METOIKESIAS BABULWNOS GENEAI DEKATESSARES KAI + APO THS METOIKESIAS BABULWNOS EWS TOU XRISTOU GENEAI DEKATESSARES';
Note: add and remove the "|| $b cmp $a" from the end of "sort" to see the different behavior.
I really appreciate your time and efforts to help me find a solution for this weird and difficult problem.
In reply to **reopened**Re: weird subroutine behavior
by flaviusm
in thread weird subroutine behavior
by flaviusm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |