in reply to STUPID STUPID STUPID old me.
In addition: your code isn't very Perlish. I'll try to Perlify it a bit, mainly by using grep(). Plus, you're only looking for files, not directories, are you? The test can be simplified, that way.
I used chdir() because otherwise the filetest won't work.#!/usr/bin/perl -w use FindBin; chdir("$FindBin::Bin/.."); opendir(DIR, '.'); @dir = readdir(DIR); closedir(DIR); if(my @new = grep {-f and $_ ne "index.html"} @dir) { # send mail... # ... print "New files:\n"; print " * $_\n" foreach @new; }
|
|---|