I have been searching on how to sort multidimensional arrays. The
following code works and sorts the fourth column of the array:
---
#!/usr/bin/env perl6
# sort multidimensional array
my @opposite = (
<8976 ABD AB11 6LX NJ >,
<8860 PLN AB12 4JS NO >,
<8905 DYC AB21 7EQ NJ >,
<8964 STN AB39 2NE NO >,
);
for @opposite -> $line { say $line; }
say "-" x 22;
@opposite = @opposite.sort({@$^a[3]});
for @opposite -> $line { say $line; }
---
I have adapted this from:
http://www.wellho.net/resources/ex.php?item=p600/mapper
I wanted to ask about the syntax, buy I have understood it while
writing the message ;) :D
Leve the code just in case is useful for somebody else.
Cheers!
--
(≧∇≦) Mimosinnet (Linux User: #463211)