s/// doesn't work like that. In s/PATTERN/REPLACEMENT/ the PATTERN in a regular expression, like the one you've given, but the REPLACEMENT part isn't. The replacement is just a string use like a regular double-quoted string. The /e makes the string evaluate, i.e. act like code instead of a piece of chars and [A-Z]* isn't valid Perl code. So remove the e, don't use a pattern in the replacement part, and ultimately fix your pattern. That might include capturing a part of the match matched by PATTERN, and you then interpolate that match in the replacement part (as the replacement is just a double-quoted string). What you really want to have, I think, is
Now this introduce quite a few things, like ^, (), .*, \., \z, and $1. You can read more about them in perlretut and other documents that come with Perl. To learn about s/// see perlop.$file =~ s/^([A-Z].*)\.pdf\z/$1/;
Update: Didn't read closely enough; adjusted the pattern to fit the OP.
ihb
See perltoc if you don't know which perldoc to read!
In reply to Re: using s/// to remove file extensions
by ihb
in thread using s/// to remove file extensions
by Plotinus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |