Re: math stuff...

2003-07-01 Thread mgoland
- Original Message - From: "Ling F. Zhang" <[EMAIL PROTECTED]> Date: Tuesday, July 1, 2003 7:04 am Subject: math stuff... > okay...I am glad @ how easy it is to use perl scalar > both as numerical value and string...but sometimes I > just need to do integer division the C way: sure, you

Re: math stuff...

2003-07-01 Thread Rob Dixon
Ling F. Zhang wrote: > okay...I am glad @ how easy it is to use perl scalar > both as numerical value and string...but sometimes I > just need to do integer division the C way: > > when 10/3, I want it to equal to 3, not 3.3 > is there an operator for such operation? or do I have > to do li

RE: math stuff...

2003-07-01 Thread Hanson, Rob
A few ways depending on your exact need... (See: perldoc -f int) my $x = int(10/3); # $x = 3 (See: perldoc integer) use integer; my $x = 10 / 3; # $x = 3 (See: perldoc -f sprintf) my $x = sprintf("%d", 10/3); # $x = 3 (rounded down) Rob -Original Message- From: Ling F. Zhang [mailto:[