As long as you put working code in there it should time it. The code posted more than likely wont work, its just a visual example.use strict; use warnings; use diagnostics; use Time::HiRes qw( time ); my $start = time(); stringsNthings(); your actual code goes here; whether it be system(whatever_prog, whatever_arg); or sub stringsNthings{ my $hello_world = "hello world\n"; my $sum = 1 + 2; chomp(my name = <STDIN>); } print stringsNthings($hello_world); print stringsNthings($sum."\n"); print stringsNthings($name); my $end = time(); my $runtime = sprintf("%.16s", $end - $start); print "This script took $runtime seconds to execute\n";
In reply to Re^3: timing a command execution with perl
by james28909
in thread timing a command execution with perl
by savio
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |