title: Legal values for Perl hash key
body: <p>I'm trying to reuse a library function we have in house, but due to new variants in my input things are not working right and throwing errors.</p>
  
  <p>I realise the problem is that it is now trying to assign a funky sentence as the hash key such as the below list of keys and as you might expect, it's not liking it. Is there a way I can encode this before hashing it to prevent any sort of gag from Perl?</p>
  
  <pre><code>Document: Multiple Attribute Equals (#root3 #form input[type=hidden], #root3 #form input[type=radio])
  Document: Attribute selector using UTF8 (#root3 span[lang=ä¸­æ–‡])
  Document: Attribute Ends With (#root3 a[href $= 'org/'])
  Document: Attribute Contains (#root3 a[href *= 'google'])
  Document: Select options via [selected] (#root3 #select1 option[selected])
  Document: Select options via [selected] (#root3 #select2 option[selected])
  Document: Select options via [selected] (#root3 #select3 option[selected])
  Document: Grouped Form Elements (#root3 input[name='foo[bar]'])
  Document: :not() Existing attribute (#root3 #form select:not([multiple]))
  Document: :not() Equals attribute (#root3 #form select:not([name=select1]))
  </code></pre>