in reply to time taken for prog to finish..

On unix machines you can use the time program (not to be confused with perls time function) to get this information....
% time perl -e 'sleep 3' 0.01user 0.01system 0:03.02elapsed 0%CPU (0avgtext+0avgdata 0maxreside +nt)k 0inputs+0outputs (246major+28minor)pagefaults 0swaps
If you look closely at this output you'll see that it took 3.02 seconds to run the program (in this case perl -e 'sleep 3')

-Blake

Replies are listed 'Best First'.
Re: Re: time taken for prog to finish..
by Kanji (Parson) on Jan 25, 2002 at 13:28 UTC

    If you don't mind trading granularity for portability, you can make use of the magic variable $^T at the end of your script ...

    END { printf "Took %d seconds to run.\n", time - $^T; }

        --k.


      Hi... I have tried to put it in my prog:
      while(<>){ ..... } END { printf "Took %d seconds to run.\n", time - $^T; }
      Hm but when I compile it... it doesn't print out anything. I also try using the ";" after the last }. Thanks..