my $n=34.57889; $n=~/(-?\d+\.\d{3})/; print "$n - $1\n";
Update: Added -? to the regex to handle negative numbers (thanks halley)
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
In reply to Re: Want to Truncate A Number... NOT round it
by CountZero
in thread Want to Truncate A Number... NOT round it
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |