Dear Monks,

I am doing a sorting program for index. In the index, i have many section levels, in that i want to do alphabetical sorting for the text part.

The problem is, the tertiary levels 004 and 005 should be sorted separately and tertiatry levels 007,008 and 009 should be sorted separately because the above tertiary levels are present in different secondary levels.

How can i proceed and which module can be used for this, shall i use sort::Natural for this.

The following are the input and output of the index.

Input:

<indexEntry> <primaryIE id="001">sloshing, definition </primaryIE> <secondaryIE id="002">solitons </secondaryIE> <secondaryIE id="003">boundary conditions, Dirichlet </secondaryIE> <tertiaryIE id="004">Cauchy condition </tertiaryIE> <tertiaryIE id="005">asymmetric modes </tertiaryIE> <secondaryIE id="006">natural frequencies </secondaryIE> <tertiaryIE id="007">boundary conditions, Neumann </tertiaryIE> <tertiaryIE id="008">canals, circular </tertiaryIE> <tertiaryIE id="009">baffle, annular </tertiaryIE> <secondaryIE id="010">annular sector </secondaryIE> <primaryIE id="011">mode shapes </primaryIE> </indexEntry>

Output:

<indexEntry> <primaryIE id="001">mode shapes </primaryIE> <secondaryIE id="002">annular sector </secondaryIE> <secondaryIE id="003">boundary conditions, Dirichlet </secondaryIE> <tertiaryIE id="004">asymmetric modes </tertiaryIE> <tertiaryIE id="005">Cauchy condition </tertiaryIE> <secondaryIE id="006">natural frequencies </secondaryIE> <tertiaryIE id="007">baffle, annular </tertiaryIE> <tertiaryIE id="008">boundary conditions, Neumann </tertiaryIE> <tertiaryIE id="009">canals, circular </tertiaryIE> <secondaryIE id="010">solitons </secondaryIE> <primaryIE id="011">sloshing, definition </primaryIE> </indexEntry>

Can anyone give some suggestions, to proceed.

Thanks in advance

Prasad


In reply to Index sorting by prasadbabu

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.