#!/usr/bin/perl -w use strict; use Time::HiRes qw[ time ]; # OP: "I have a perl script that I need to run 1000 times and for each run # I need to store how much time it took to run... " # using foo_a.pl, execute this from foo_a's dir # Timings of foo_a.pl are NOT precise because they include the time # to execute the calculations here. my $begin = time; for my $arg( 1..1000 ) { my $start = time; system "perl foo_a.pl $arg"; my $duration = (time - $start); print "\n\t\$arg: $arg, \t\$start: $start, \t\$duration: $duration\n"; $start = time; } print "$begin" . time . "\n"; exit;