At 04:11 PM 07/10/2001 -0400, Moon, John wrote:
>One way to do it ...
>
> perl -e '$x=1234.5678; ($y)=$x=~/(\d*\.{0,1}\d{0,2})/;print $y ."\n";' 

heh...that was pretty close to perl bowling ;-)

Don't do wierd contrortions with regexps when theres a simple built-in
function to pull off the same results. Use sprintf:

print sprintf "%.2f", $number;

Aloha,
mel



__________________________________________________________
mel matsuoka                    Hawaiian Image Productions
Chief Executive Alphageek              (vox)1.808.531.5474
[EMAIL PROTECTED]                  (fax)1.808.526.4040

Reply via email to