How can I convert between scientific and decimal notation in Perl?
问题 I know this is a total newbie question, but the answer may not be obvious to many new programmers. It wasn't initially obvious to me so I scoured the Internet looking for Perl modules to do this simple task. 回答1: sprintf does the trick use strict; use warnings; my $decimal_notation = 10 / 3; my $scientific_notation = sprintf("%e", $decimal_notation); print "Decimal ($decimal_notation) to scientific ($scientific_notation)\n\n"; $scientific_notation = "1.23456789e+001"; $decimal_notation =