in reply to First code test view
First, you can't use "eq" when you want to use a regular expression. "eq" is a string comparison operator, so what you're asking Perl to do is see if $find ever equals the (uninterpolated) string '/\.log$/i || /\.\d+\w+\-\d+\wm$/i'. Unless you're running a REALLY strange file system you don't have any files named that. ;-Dif ($file eq '/\.log$/i || /\.\d+\w+\-\d+\wm$/i')
What you probably want is to change it over to a regular expression like this:
The =~ m operator is a matching operator which means your "if" statement is now looking for a $file that either ends in ".log" or ends in some sort of (looks like) date format. This is probably closer to what you want.if ($file =~ m/\.log$/i || $file =~ m/\.\d+\w+\-\d+\wm$/i)
Gary Blackburn
Trained Killer
|
|---|