I've written some Perl code to write HTML and have run into a bit of a problem regarding quotes in the data. To simplify the problem, I've got this kind of thing:
$note = "Joe's cat \"should\" be OK";
print "<input type='text' name='note' value='$note'>";
The result in the browser is, the value "Joe" appears as the value in the field. This seems to be because I'm using single quotes around '$note' in the value attribute, and if I change them to double quotes (which will need to be escaped), I'll end up with "Joe's cat " for a similar reason.
How do I get values, which could contain single and/or double quotes, to appear as values in <input> tags?