in reply to More Detailed Timing than Time::HiRes' clock method

Have you even looked at the documentation for Time::HiRes?

$your_code =~ s/clock/time/g;

...and then you should get something like:

perl nano foo.pl It took 0.01027512550354 second

Replies are listed 'Best First'.
Re^2: More Detailed Timing than Time::HiRes' clock method
by Anonymous Monk on Sep 27, 2006 at 01:52 UTC
    McDarren,
    How can you use 'nano' there? Cause when I followed your suggestion and calling 'nano' it gives me:
    Can't open perl script "nano": No such file or directory.
    Nevertheless, without nano it prints the refined results though.

    BTW also, what is the difference between time() as used by you versus liverpole's suggestion of using 'tv_interval' and 'gettimeofday'?
      "How can you use 'nano' there?..."

      I think perhaps my example was a little misleading. "nano" is the name of the script, and "foo.pl" is the name of the file being precessed. Think of it instead as:

      perl nano some_random_file
      ..and it should make more sense.

      "..what is the difference between time() as used by you versus liverpole's suggestion of using 'tv_interval' and 'gettimeofday'?"

      Again, rtfm. As far as I can see, there is no real difference. The resolution that you get will be mostly system-dependant.

      Cheers,
      Darren