On 06/08/2018 09:44 PM, Brent Laabs wrote:
> It isn't in any variable, @x.sort got called in sink context.=C2=A0 You=
'll=20
> have to assign it if you want, maybe use @x.=3Dsort ?
>=20
Is alright. I didn't understand what was happening anyway.
Thank you for the help!

The magic trick is that the last line in the code block is the return val=
ue.
when you pass a function that takes a single argument (in this case just
the $_) to sort, it will call your function for every element in the
input array and use the result of that function to sort the elements by.
The "// 0" is there in every field because if the input line doesn't
have the expected format, you'll get a bunch of warnings, because the
variables will contain undefined values, you can try it for yourself
with inputs like "anaconda", "beetle", "zebra".
The last part of the puzzle is how sort will sort lists of lists
(because it has now replaced every string with a list of the parts we've
supplied); By default, sort uses the earliest entry in the list that is
different, so it's very much like lexicographic sort.
Does that explain everything?
=A0 - Timo