On 7/24/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
Hi All,
I have two questions, is it correct to execute subs like this:
Sub_1 (sub_2))? I am trying to pass the return value of sub_2 into sub_1.
Also, I have been looking at perldoc etc to limit the # of digits returned
after a decimal, it looks difficult? Am I overlooking a simple method?
Yes, a subroutine call is an expression, so it can be used as an
argument to another subroutine. There are several ways to round a
number, the easiest (especially if you don't care how it is rounded)
is to use sprintf or printf:
perl -e 'printf "%.2f\n", 100.12345'
You can find out more about the formating specifiers in perldoc -f sprintf
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/