in reply to timing a command execution with perl

Why not use the program time?

  • Comment on Re: timing a command execution with perl

Replies are listed 'Best First'.
Re^2: timing a command execution with perl
by Anonymous Monk on Dec 09, 2014 at 14:59 UTC
    Indeed I used it in my perl program:
    system("time", "program-name", "file-name"); but the out is different (and confused) with respect to that right output I have just typing time program-name file-name in the shell.

      time typically outputs its values to STDERR (unless your version supports the -o option). To capture STDERR in a Perl program, something like Capture::Tiny or IPC::Run3 makes that easy. (Or you can use shell redirects.)