in reply to First Question, why something works? (-M)
-M uses $_. Tip #6 from the Basic debugging checklist ... B::Deparse
sub BEGIN { use warnings; use strict 'refs'; require 5.01; } use warnings; use strict 'refs'; BEGIN { $^H{'feature_say'} = q(1); $^H{'feature_state'} = q(1); $^H{'feature_switch'} = q(1); } die "No file names supplied!\n" unless @ARGV; my $oldest_name = shift @ARGV; my $oldest_age = -M $oldest_name; foreach $_ (@ARGV) { my $age = -M $_; ($oldest_name, $oldest_age) = ($_, $age) if $age > $oldest_age; } printf "The oldest file was %s, and it was %.1f days old\n", $oldest_n +ame, $oldest_age;
See also How do I compose an effective node title?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: First Question, why something works? (-M)
by i255d (Initiate) on Apr 16, 2014 at 12:44 UTC | |
by Athanasius (Archbishop) on Apr 16, 2014 at 13:38 UTC | |
by i255d (Initiate) on Apr 16, 2014 at 13:51 UTC | |
by Anonymous Monk on Apr 16, 2014 at 20:44 UTC | |
by Laurent_R (Canon) on Apr 16, 2014 at 13:20 UTC |