Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Problem using Test::Simpleby beable (Friar) |
on Jul 22, 2004 at 11:06 UTC ( [id://376537]=note: print w/replies, xml ) | Need Help?? |
It looks to me like it does "work". You'd have to say what you were expecting, and how the output differs from what you wanted to see. The first warning about "main::a" being used only once, is because in the first subroutine you have the line $a=9; but $a is never used again. This is a standard Perl warning, because using a variable only once is often a sign of a typo, in that you spelled a variable name wrong. If you put use warnings; use strict at the start of your program, it will greatly reduce errors from this. As for the warnings about "too few iterations", if you look at the documentation for Test::Benchmark, you'll see that the first argument to is_faster is the number of times to run each sub. Once is clearly not enough iterations to determine which is faster. Secondly, it is rather pointless to be timing code which is waiting on user input. If you type quickly for "enter a name" and type slowly for "give input", your test will pass, and vice-versa.
In Section
Seekers of Perl Wisdom
|
|