in reply to Last mod not working
you lose any distinction between head() failing (which returns an empty list) and head succeeding but modtime not being available. If you need to differentiate between the two, you can do it (without introducing any temp variables) by saying:my ($lastMod) = (head($url))[2];
or evenif (my (undef,undef,$lastMod) = head($url)) { # success if (!defined $lastMod) { # but alas no mod time } }
This are instances of a list assignment in scalar context, which yields the number of entries in the list on the right hand side of the assignment (5 if head succeeded, 0 if it failed).my $gotHead = (my (undef,undef,$lastMod) = head($url));
|
|---|