The first warning is because on the third line of the main bit of code you've used $a, but that's the only place you've used it. You can find out more about perl's warnings by checking in perldiag or using the diagnostics pragma.
The problem with the benchmarking part of the code looks like two things: a) you're using 'stdin' and not 'STDIN'; b) you're only looping once. The first is because the four builtin filehandles (STDIN, STDOUT, STDERR, and DATA) are all in uppercase not lowercase, so your code perhaps should be $b = <STDIN>. The warning is produced by Test::Benchmark because you've only specified one iteration to is_faster which means the code executes faster than the resolution of the system clock.
--
integral, resident of freenode's #perl
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|