in reply to Compact script for time difference in seconds

I wonder if you can do something like this?
#!/usr/bin/perl use strict; my $time_1 = time(); sleep 2; my $time_2 = time(); my $diff = $time_2 - $time_1; print scalar localtime( $time_1 ) . "\n"; print "Epoch Time 1: $time_1\n"; print scalar localtime( $time_2 ) . "\n"; print "Epoch Time 2: $time_2\n"; print "Difference: $diff seconds.\n";

Replies are listed 'Best First'.
Re^2: Compact script for time difference in seconds
by vit (Friar) on Sep 17, 2009 at 16:25 UTC
    Thank a lot!!
    I think this one is perfect for me purpose.