Mr. Shawn H. Corey wrote: > On Fri, 2006-31-03 at 14:41 -0700, Bryan Harris wrote: >>I have a script that takes ~5 seconds to run, but I'd like to get it down to >><1 sec. My problem is I don't know which part is the slow part. So given >>something like this: >> >>************************************** >>#! /usr/bin/perl -w >> > > my $start_time = time;
Or you could just use Perl's built-in $^T variable. >>(code chunk 1 here) >> > > print "chunk 1: ", time - $start_time, " seconds\n" > $start_time = time; print "chunk 1: ", time - $^T, " seconds\n"; >>(code chunk 2 here) >> > > print "chunk 2: ", time - $start_time, " seconds\n" > $start_time = time; print "chunk 2: ", time - $^T, " seconds\n"; >>(code chunk 3 here) > > print "chunk 3: ", time - $start_time, " seconds\n" print "chunk 3: ", time - $^T, " seconds\n"; And don't forget the semicolons. :-) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>