####
sub thousandformat { # Formats number with thousand separators
my ($number) = @_;
my $currnb = "";
my ($mantis, $decimals) = split(/\./, $number, 2);
$mantis =~ s/[^0-9]//g;
while ( length($mantis) > 3 ) {
$currnb = "'".(substr($mantis, length($mantis)-3, 3 )).$currnb;
$mantis = substr($mantis, 0, length($mantis)-3);
}
$currnb = $mantis.$currnb;
if ( $decimals ) { $currnb .= ".".$decimals; }
else { $currnb .= ".00"; }
return $currnb;
}