I think it is called "Schwartzian Transform". That's why you couldn't find it ;-). Basically it's a sorting technique for arrays of multiple fields. With it you can sort them according to any fields you prefer. Suppose you have this data:
-r--r--r-- 1 yourname 8318 Jan 30 1996 file1.txt -r--r--r-- 1 yourname 11986 Jan 30 1996 file2.txt -r--r--r-- 1 yourname 46852 Feb 27 1996 file3.txt -r--r--r-- 1 yourname 72698 Feb 27 1996 file4.txt
And you want to sort them according to size. You would do it with ST like this:
@sorted_by_size = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, -s] } @files;
So in principle you would do ST in the following step:
1. Map the initial list into a list of ref to lists with the original +and modified values 2. Sort the list of references 3. Map the list of ref back into a plain list with the initial values
Check this out by the very creator himself - Randal Schwartz (merlyn).
Regards,
Edward

In reply to Re: What is "Schwartzian Transform" by monkfan
in thread What is "Schwarzian Transform" (aka Schwartzian) by GrandFather

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.