#----------
# subroutines
sub trim {
    local $_ = shift;
    s/\n/ /sg;		# convert newlines to spaces
    s/\r/ /sg;		# convert carriage returns to spaces
    s/\000/ /sg;	# convert nulls to spaces
    s/^\s+//sg;		# trim leading spaces
    s/\s+$//sg;		# trim trailing spaces
    return $_;
}

sub collapse {
    local $_ = shift;
    s/\s+/ /sg;		# collapse multiple spaces to just one
    return $_;
}

sub squash {
    local $_ = shift;
    s/\s//sg;		# remove all spaces
    return $_;
}


sub round {
        my($number) = shift;
        return int($number +.5 * ($number <=> 0) );
        };

