in reply to Rename old files that do not begin with a dot
Have you tried taking the single quotes off of the '$_, !~ /^\./' part? Also, you shouldn't have a comma in that. So you'd have:
if (-f && $_ !~ /^\./ && ($age > $limit)) {
... which you'd likely want to disambiguate for the programmer (perl has no problem) by using parentheses:
if (-f && ($_ !~ /^\./) && ($age > $limit)) {
... and since pattern matches apply by default to $_ you could write as:
if (-f && (! /^\./) && ($age > $limit)) {
Yet you'd still have problems with files named, for example, 'foo' and '.foo', as you often can't rename one over the other and it will clobber the existing '.foo' with 'foo' if you can.
|
|---|