This is how I explored before source diving in Sorting Template Toolkit Array of Hashrefs

[%# ## tpage sort.compound.tt ## tpage --debug=2047 sort.compound.tt ## tpage --debug=all sort.compound.tt ## ## tpage --debug=off sort.compound.tt ## tpage --debug=vars sort.compound.tt ## tpage --debug=filters sort.compound.tt ## tpage --debug=dirs sort.compound.tt ## tpage --debug=provider sort.compound.tt ## tpage --debug=plugins sort.compound.tt #~ unknown debug flag ## tpage --debug=flags sort.compound.tt ## tpage --debug=stash sort.compound.tt ## tpage --debug=undef sort.compound.tt ## tpage --debug=context sort.compound.tt ## tpage --debug=caller sort.compound.tt ## tpage --debug=parser sort.compound.tt ## tpage --debug=all sort.compound.tt ## tpage --debug=on sort.compound.tt ## tpage --debug=service sort.compound.tt ## ## http://perlmonks.org/?node_id=982470# Re^3: Sorting Template Toolki +t Array of Hashrefs ## ## ## ## COMMENTS END -%] [% SET results = [ { 'a' => [ { 'b' => 6 } ] }, { 'a' => [ { 'b' => 3 } ] }, { 'a' => [ { 'b' => 4 } ] }, { 'a' => [ { 'b' => 9 } ] }, ]; %] [% USE Dumper Indent = 0; GET Dumper.dump( results ); %] ## [% FOREACH item IN results.sort %] [% USE Dumper Indent = 0; GET Dumper.dump( item ); -%] [% END %] ## [% FOREACH item IN results.nsort('a.0.b') %] [% USE Dumper Indent = 0; GET Dumper.dump( item ); -%] [% END %] #################### #################### [% SET results = [ { 'a' => [ { 'b' => 6 } ], 'a.0.b' => 6 }, { 'a' => [ { 'b' => 3 } ], 'a.0.b' => 3 }, { 'a' => [ { 'b' => 4 } ], 'a.0.b' => 4 }, { 'a' => [ { 'b' => 9 } ], 'a.0.b' => 9 }, ]; USE Dumper Indent = 0; FOREACH item IN results.nsort('a.0.b'); GET Dumper.dump( item ); GET "\n"; END; %]

In reply to Re^3: Sorting Template Toolkit Array of Hashrefs by Anonymous Monk
in thread Sorting Template Toolkit Array of Hashrefs by roho

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.