Sorry for not being clear in requirement. Consider my OBJD Array data is like shown below:

1 ab 2 3 cd 4 5 6 6 9 rc 4 5 ef 6 3 4 1 7 fa 5 2 tg 5 9 9 0 3 bg 3 9 jh 5 2 2 1

I want to create a subroutine which takes two argument as input, First argument is array and second argument is column number on which sorting has to be done. Say for example sort_array is a subroutine and I pass OBJD array and column to sort as arguments. something like sort_array(\@OBJD,2) and this should provide me below output

1 ab 2 3 cd 4 5 6 6 3 bg 3 9 jh 5 2 2 1 9 rc 4 5 ef 6 3 4 1 7 fa 5 2 tg 5 9 9 0

Or something like sort_array(\@OBJD,6) and this should provide me below output

3 bg 3 9 jh 5 2 2 1 9 rc 4 5 ef 6 3 4 1 1 ab 2 3 cd 4 5 6 6 7 fa 5 2 tg 5 9 9 0

Would like to do it using regular sorting method as well as using 'Schwartzian transform' just to learn it.


In reply to Re^3: Sorting based on any column by Anonymous Monk
in thread Sorting based on any column by Anonymous Monk

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.