#!usr/bin/perl
use strict;
use warnings;
my $value = shift or die "Enter the second parameter\n";
&secondTOhours(\$value);
sub secondTOhours(){
my ($seconds)= @_;
my $hrs = int( $$seconds / (60*60) );
my $min = int( ($$seconds - $hrs*60*60) / (60) );
my $sec = int( $$seconds - ($hrs*60*60) - ($min*60) );
print("$hrs hours, $min minutes, and $sec seconds.\n");
}
$perl secondsTohours.pl 3600
1 hours, 0 minutes, and 0 seconds.
0 comentários:
Post a Comment