Date: 27 Sep 2001 11:27:28 GMT From: damian@qimr.edu.au (Damian James) Subject: Re: maths Message-Id: On Thu, 27 Sep 2001 12:12:34 +0100, Chris said: >stop talking nonsense and just tell me how to tell a scalar value to correct >itself to two decimal places. Am I missing something? What nonsense? $value =~ s/^(\d+\.\d\d)\d*$/$1/; will work if you can guarantee there will be at least one digit followed by a period followed by at least two digits. For a better solution, there's no substitute for the documentation: perldoc -q round perldoc -f sprintf If you're not familiar with it, this is the online documentation that is included with every (working) installation of perl. The idea is that you type either of the above incatations on the command line. >are these forums for people to help one another. Indeed, but there are a few conventions that aid in making sure this does in fact happen. One is that you don't try to take cuts in line, by which I mean you are expected to check the documentation before posting a question here. It's unlikely to help you if you are rude to the regulars, either ;-). HTH Cheers, Damian -- @:=grep!(m!$/|#!..$|),split//,;@;=0..$#:;while($:=@;){$;=rand $:--,@;[$;,$:]=@;[$:,$;]while$:;push@|,shift@;if$;[0]==@|;select$,, $,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/} __END__ Just another Perl Hacker,### http://home.pacific.net.au/~djames.hub