in reply to How to remove an apostrophe?

Then, once I have the file name, I try to remove the apostrophe.

The preferred practice when cleaning up things like filenames is to specify what you will accept rather than what you will reject. For instance, if you used a substitution like $newName =~ s/[^\w.-]//g; you may not have run into this problem at all. (Assuming that the problem really was a character in your filename that only appeared to be an apostrophe.)

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re^2: How to remove an apostrophe?
by dragonchild (Archbishop) on Oct 12, 2005 at 20:27 UTC
    For completeness. sauoq is referring to the practice of whitelisting (specifying what you'll accept) vs. blacklisting (specifying what you'll reject). Whitelisting is generally considered to be preferable because the list of things you know you want is generally easier to specify than the list of things you know you don't want. This is especially true when dealing with untrusted input because you can never know about all the crazy wacked-out $h!t people are going to throw at you, maliciously or stoopidly. (Though, one can argue that stoopidity is a form of negligent maliciousness...)

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?