http://qs321.pair.com?node_id=280855


in reply to Re: Daft Regexp
in thread Daft Regexp

The problem is not the regex. Take a look at the values of $newname and $newdirname and the error messages. Look at the ouptut after adding

rename ... or die "Error renaming $newname: $!"; #use $newdirname where appropriate

to each rename statement.

Since you are renaming _every_ file and directory, the whole rename sequence is practically begging to be taken out of the if/elsif statement.

PS: You probably want to take a look at File::Find