sub sortmx() {
    if(not defined(@_)) {
	return(undef);
    } else {
	my($mxs) = shift;
	my(%mx_list, $mx, $prec, $line);
	foreach $mx (split(/\n/m, $mxs)) {
	    ($prec, $line) = split(/\s+/, $mx);
	    $prec += 20000;
	    $mx_list{$prec} = $line;
	}
	if (%mx_list) {
	    my($res);
	    foreach (sort(keys(%mx_list))) {
		$res .= ':' if ($res);
		$res .= $mx_list{$_};
	    }
	    return($res);
	} else {
	    return('not found');
	}
    }
}
