@sorted = map { $_->[1] }
sort { $a->[0] <=> $b->[0] }
map { [ (split /-/)[2], $_ ] } @array;
# In other words...
# we're going to make a list of things to stuff into an array named '@sorted'
@sorted = # "What things? Where are they?"
( # They are the things we get back from this map() operation:
map # "What? What's map()? This isn't boy scouts!"
+( # map() means we're going to scan through a list of things, and
{ $_->[1] }, # execute this code block (left) on each of its items.
( # "But where's the list?" It is the things we get back from
sort # sort() -ing out _just another_ little LIST OF THINGS.
+( # "How? By letter?" No, by number, biggest to smallest.
{ $a->[0] <=> $b->[0] }, # "What's the '<=>' thingy for?"
# It's an operator like '!=', '>=', or '==', but it
# that tells Perl sort() numerically instead of
# the default behavior (alphabetically from A-z).
# "So what are we sorting?" Funny you asked, it's
# _yet another_ LIST OF THINGS!
( # The list is is made from what we get by...
map # using map() once more to prepare the contents of
+( # another LIST OF THINGS for evaluation by sort()
# This list comes from what we get by running this
# next block of code on each item of (guess what)
# _still another_ LIST OF THINGS!
{ [ (split /-/)[2], $_ ] }, #<--That's the code,
@array # <--and here's that &*#@$! LIST OF THINGS
)
)
)
)
)
);
# Without commentary:
@sorted =
(
map
+(
{ $_->[1] },
(
sort
+(
{ $a->[0] <=> $b->[0] },
(
map
+(
{ [ (split /-/)[2], $_ ] },
@array
)
)
)
)
)
);