good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Timing a Subroutine with Parametersby arunhorne (Pilgrim) |
on Jul 21, 2002 at 18:43 UTC ( [id://183848]=perlquestion: print w/replies, xml ) | Need Help?? |
arunhorne has asked for the wisdom of the Perl Monks concerning the following question: Monks In my current program I wish the user to be given feedback as to the execution time of various sections of the program. As such I have broken the program into a series of logical operations, each contained within a subroutine. I am using the Benchmark module included with perl to measure execution time. Some of the subroutines do not require parameters and thus the following is fine:
However, some of the stages that I wish to time take parameters that are passed from the command line. the following code demonstrates the problem.
The code has no syntax errors and the subroutine runs. However, instead of outputting timings, once the sub has executed the following error is output:
Is it possible for me to time code like this... or must I use a different approach. I could use the time function and just find the difference for each subroutine before and after, but this in inflexible and I would rather do it properly.
Thanks in advance, ____________Arun
Back to
Seekers of Perl Wisdom
|
|