in reply to time taken for prog to finish..

The Benchmark module should do what you need. Ex:
use Benchmark; my $start_time = new Benchmark; # do your processing my $end_time = new Benchmark; my $execution_time = timediff($end_time, $start_time); print timestr($execution_time);

Sample output:

4 wallclock secs ( 3.64 usr +  0.00 sys =  3.64 CPU)

You could easily extract the information you need from this string.

See perldoc benchmark for more info...