http://www.perlmonks.org?node_id=1158186

a01 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I need my Perl script to unescape a JavaScript string literal that is in a <script> tag in HTML code that I need to parse. For example:

<script type="text/javascript">window.open ('https\x3a\x2f\x2fexample. +com')</script>

If I capture the string with a regular expression, I get the string:

https\x3a\x2f\x2fexample.com

I need to decode this to:

https://example.com

How do I do this in Perl?