in reply to Benchmark diamond operator

close ARGV if eof;

I haven't tested any of this, but I believe this close statement in each of the test_* functions will prevent the other from doing anything: you can't read anything on a closed filehandle. Rather than close-ing the ARGV filehandle, I would seek to the beginning of the handle before each data-read operation in each test function.

Update:

... seek to the beginning of the handle before each data-read operation in each test function.
A little experimentation shows my idea is wrong. seek cannot be used on ARGV before execution of the  <> operator in the
    while (<>) { ... }
loop because the handle has never been opened. seek cannot be used on ARGV after the loop because the handle has been closed. It's possible to seek, etc., on ARGV within the loop, but I can't see how this would be useful in this particular situation.


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^2: Benchmark diamond operator
by thanos1983 (Parson) on May 09, 2017 at 15:13 UTC

    Hello AnomalousMonk,

    Well I thought that closing the file would allow to open the file again on next iteration. I could try to apply what you proposed and see how it goes.

    Thanks for your time and effort.

    Seeking for Perl wisdom...on the process of learning...not there...yet!