#!/usr/local/bin/perl # Name: mybin/mostrecent Author: Joe Smith 21-Jul-95 # Purpose: Returns name of file that was modified most recently. $newest_file = shift; die "Usage: mostrecent file1 file2 ...\n" if $newest_file eq ""; $newest_date = (stat($newest_file))[9]; foreach $_ (@ARGV) { $date = (stat($_))[9] || 0; # Ignore "no such file" error ($newest_date,$newest_file) = ($date,$_) if $date > $newest_date; } print $newest_file,"\n";