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;
Any help?
Thanks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Escaping single quote in $string
by moritz (Cardinal) on Feb 17, 2013 at 20:48 UTC | |
Re: Escaping single quote in $string
by tangent (Parson) on Feb 17, 2013 at 21:15 UTC | |
Re: Escaping single quote in $string
by manorhce (Beadle) on Feb 17, 2013 at 21:57 UTC | |
Re: Escaping single quote in $string
by calebcall (Sexton) on Feb 17, 2013 at 22:10 UTC | |
by Anonymous Monk on Feb 17, 2013 at 23:23 UTC | |
by Anonymous Monk on Feb 18, 2013 at 17:00 UTC |