Blob


1 #!/usr/bin/perl
3 # Make a program to identify the oldest file named on the command
4 # line and report its age in days. What does it do if the list is
5 # empty? (That is, if no files are mentioned on the command line.)
7 use v5.24;
8 use warnings;
9 use strict;
10 use utf8;
12 my $max = 0;
13 my $maxfile;
14 foreach (@ARGV) {
15 if (-e) {
16 my $age = -C;
17 if ($age > $max) {
18 $max = $age;
19 $maxfile = $_;
20 }
21 }
22 }
24 printf("%s: %.1f days\n", $maxfile, $max) if defined($maxfile);