|The stupid question is the question not asked|
Escaping single quote in $stringby calebcall (Sexton)
|on Feb 17, 2013 at 20:44 UTC||Need Help??|
calebcall has asked for the wisdom of the Perl Monks concerning the following question:
I have a script that searches for media files to convert. These files could contain apostrophes in their name (i.e. the TV Show, How It's Made). That apostrophe (single quote) makes my script bomb out. What I need to do is escape it or remove it from the file name. I've tried the following, but none of them work. I'm sure I'm just doing something wrong.
$string =~ s/'/\\'/g;
$string =~ s/\'/\\'/g;
$string =~ s/\'//g;