Rob wrote: > > I'm working on a script that parses a log file which gives connection time > in seconds. Below is how I resolved the problem but I think there must be > a better way? > > #!/usr/bin/perl -w > > use strict; > > my $sessionTime = 4000; > > my $hour = $sessionTime / 3600; > my $hr = int($hour); > $sessionTime = $sessionTime - ($hr * 3600); > my $minute = $sessionTime / 60; > my $min = int($minute); > my $sec = $sessionTime - ($min * 60); > print "$hr hour $min minutes and $sec seconds.\n"
If you only need hours, minutes and seconds then this will work: $ perl -e'$t = 4_000; ($s,$m,$h) = gmtime( $t ); print "Hour: $h\nMin: $m\nSec: $s\n"' Hour: 1 Min: 6 Sec: 40 John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]