use Number::Format ':subs'; for (qw($100000000.00 $100.00 $1000.00)) { s/^\$//; $_ = '$' . format_number( $_, 2, 2 ); print; }