Chas Owens wrote:

On 7/24/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:

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

If you really don't care how a number is rounded, then just replace
it by zero.

Rob



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to