use Benchmark; my $code = ''; print "Enter number of code runs:\n"; my $runs = ; chomp ($runs); print "Inline or load up code(1|2)?\n"; my $inline = ; chomp($inline); if($inline == 1) { $/ = "#END"; print "Enter code block (end with #END):\n"; $code = ; chomp($code); print "\n...Testing...\n"; timethis($runs, $code); } else { my $file; my $func; print "Give me the file name: \n"; $file = ; chomp($file); $code = `cat $file`; eval($code); die $@ if $@; if($code=~m/sub\s+(\w+)/) { $func = $1; } no strict 'refs'; print "\n...Testing...\n"; timethis($runs, &$func); } #### sub manic { my $x = 0; for (0..50) { $x++; } print $x; } #### :)~> perl bmark.pl Enter number of code runs: 2000 Inline or load up code(1|2)? 2 Give me the file name: test.al ...Testing... 51timethis 2000: 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU) (warning: too few iterations for a reliable count)