in reply to Why won't $' work in a trinary operation?

The problem is that your ?: line is parsed by Perl as:
($base_string =~ /^#/ ? ($foo = $') : $bar) = $base_string;
Add parens to your expression to get the operations to occur in the right manner:
$base_string =~ /^#/ ? ($foo = $') : ($bar = $base_string);