A common task for a system administrator is to recursively search the
directory tree for certain items. On Unix, this is typically done
with the find command. We can do that directly from
Perl, too.
$ find2perl /tmp -atime +14 -eval unlink >Perl-program
That command says to search in /tmp (and
recursively in subdirectories) for items whose atime (last access
time) is at least 14 days ago. For each item, the program should run
the Perl code unlink, which will use
$_ by default as the name of a file to remove. The
output (redirected to go into the file
Perl-program) is the program that does all of
this. Now you merely need to arrange for it to be run as needed.
 |  |  |
B.25. Converting Other Languages to Perl |  | B.27. Command-line Options in Your Programs |