I\'ve written some code in Perl which executes some bash command within its execution. My problem was when bash command attributes contained white space inside which failed
It's much easier to use single quotes in bash; then the only character you need to worry about is a single quote itself.
($arbitrary_string) =~ s/'/'"'"'/g; `echo '$arbitrary_string'`