The following code was an answer posted to a query a long time back on how to sort a text file that had 5 columns of numbers and the user wanted to sort based on 2nd column. I don't understand the solution and was hoping someone could explain it.
use strict; use File::Slurp qw(read_file); print map { $_->[1] } sort { $a->[0] <=> $b->[0] } map { [(split /\s+/)[1], $_] } read_file( $ARGV[0] );
In reply to how does these map statements work by martin_100
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |