use strict; my $file = shift; if ( ! -e $file ) { die "no file" } my $age = -A _; # re-use the stat done by "-e" above if ( -d _ ) { print "directory\n" } elsif ( -T _ ) { print "probably a text file\n" } else { print "probably a binary file\n" } print "Before being read just now, $file was last read ", scalar localtime( $^T - $age*24*3600 ); # $age is in days, so multply to get seconds, subtract from # script's start-time to get original file access time, use # "scalar localtime" to print that in human-readable form