PDA

View Full Version : Remainder Spliting


Nirmal
04-10-2006, 04:34 PM
Hi
I am new to cgi/perl scripting. I have the following code.

$equivFS = 2*($FORM{Width}*$FORM{Length})/($FORM{Width}+$FORM{Length});

The result would be a real number (ex. 15.333 if width is 10 and length is 20). How can I split 15 and 333. I tried the split function but doesn't seem to work.

($bigg, $smalll) = split(/./, $equivFS);

what am i doing wrong.

Thanks in advance

FishMonger
04-10-2006, 05:30 PM
The . has special meaning in the regex...you need to escape it.

($bigg, $smalll) = split(/\./, $equivFS);