note thmsdrew <p>Thanks for that link, it was helpful for sure. Here's how I did it. The first subroutine gets the tuples from the file, splits them into an array, and writes them all into one array.</p> <code>sub get_links { my @links; open(my $fh, "<", "links.alpha.sorted.25sample") or die "cannot open < links.alpha.sorted.25sample: $!"; while(<$fh>) { chomp; my $tuple; @$tuple = split(/\s+/, $_); push(@links, $tuple); } return @links; }</code> <p>Then I sort by the second value and write it to another file:</p> <code>sub sort_and_store { my @links = get_links(); my @sorted_links = sort { $a->[1] cmp $b->[1] } @links; open(my $fh, ">", "") or die "cannot open > $!"; foreach my $tuple (@sorted_links) { print $fh "@$tuple\n"; } }</code> <p>I've never used the <code>@$blah</code> variable type before, and I couldn't find any information about it. I'm guessing that's how you refer to the arrays in an array of arrays?</p> 964070 964077