I'm new to perl and I found this expressions bit difficult to understand
$a =~ s/\'/\'\"\'\"\'/g
\ in that are useless (but harmless), so it is equivalent to
s/'/'"'"'/g. It replaces every
'"'"' in the string.
This is often used for shell quoting. See for example http://stackoverflow.com/a/24869016/17389