Mercurial > hg > forks > yadex
changeset 87:7deced264648
Make 'youngest' Perl-script strict.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 26 Sep 2011 19:44:55 +0300 |
parents | e573dd2ea3f0 |
children | ab7cd6cdb5d7 |
files | scripts/youngest |
diffstat | 1 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/youngest Mon Sep 26 19:44:26 2011 +0300 +++ b/scripts/youngest Mon Sep 26 19:44:55 2011 +0300 @@ -1,16 +1,17 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w # # youngest - print the date (yyyy-mm-dd) of the last modified file # Usage : youngest <file> ... # +use strict; -$mtime_max = 0; -foreach $fic (@ARGV) +my $mtime_max = 0; +foreach my $fic (@ARGV) { - ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, - $atime, $mtime, $ctime, $blksize, $blocks) = stat $fic; - $loc_ti = localtime $mtime; - $mtime_max = $mtime if $mtime_max < $mtime; + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, $blksize, $blocks) = stat($fic); + my $loc_ti = localtime($mtime); + $mtime_max = $mtime if ($mtime_max < $mtime); } -($ss, $mi, $hh, $jj, $mm, $aa) = localtime $mtime_max; +my ($ss, $mi, $hh, $jj, $mm, $aa) = localtime($mtime_max); printf "%04d-%02d-%02d", $aa + 1900, $mm + 1, $jj;