in reply to Complex Sort - using varying numbers of parameters
Beyond using the Schwartzian transform, you can use the magic of pack to create your sort keys! Keys N, n and C can all work, if your IDs are nonnegative and small enough (0xFFFFFFFF for the first [which will anyway put you in trouble when you try to manipulate them, or 0xFFFF for the second, or a measly 0xFF for the third).
is enough to create keys; you compare these keys with cmp, so you don't need to pass a coderef to sort (yay!).sub make_key { my $x = shift; pack 'N*', @{$x->{Path}}; }
|
---|
In Section
Seekers of Perl Wisdom