sub mtime { my $file = shift; my $option = shift; my $mtime = (stat $file)[9]; my $epoch = time(); my $mtime = $epoch-$atime; if($option eq "time") { if($mtime < 60) { my $sek = $mtime % 60; $mtime = $sek . " sec"; } elsif($mtime >= 60 && $mtime < 3600) { my $min = $mtime / 60 % 60; my $sek = $mtime % 60; $mtime = $min.":".$sek . " min"; } else { my $hour = $mtime / 3600 % 60; my $min = $mtime / 60 % 60; my $sek = $mtime % 60; $mtime = $hour.":".$min.":".$sek . " hour"; } } elsif ($option eq "date") { $mtime = scalar localtime $mtime; } }