$mech->get($_); if (!$mech->success()) { ... failed somehow.. do something print "get of $_ failed!\n"; next; }