in reply to Help in putting "$" as part of output
my $head1="$...";
with
my $head1='$...';
This should work as long as there are no single quotes ' in your string.
my $head1=q{$...}; works too. For details see Quote and Quote like Operators