#!/usr/bin/perl use LWP::Simple; use HTML::TableExtract; my $html = get "http://www.efd.lth.se/loginload.shtml" or die "Cannot get!\n"; my $te = HTML::TableExtract->new(headers => ['Name', 'Load average']); $te->parse($html)->eof; my @sorted = sort { $a->[1] <=> $b->[1] or $a->[0] cmp $b->[0] } $te->rows; for (@sorted) { print "$_->[0] has load of $_->[1]\n"; } print "exec ssh $sorted[0][0]\n";