in reply to map confusion

@links is AoA, (Array of Arrays) you can see it with:

use Data::Dumper; print Dumper(\@links);
map{$_->[0]} returns a list which consist of first elements of each inner array