[ Please don't use <pre> here. Start paragraphs with <p>, and wrap computer text (code, input, output, etc) in <c>...</c>. <c>...</c> will even handle escaping "&", "<", ">", "[" and "]" for you. ]
Is there an alternative to text_to_js_lit packaged as a module?
package Module; sub text_to_js_lit { my $s = @_ ? $_[0] : $_; $s =~ s/\\/\\\\/g; $s =~ s/'/\\'/g; # ... return qq{'$s'}; } 1;
I'm surprised that (q{\'\'} eq q{\'\'}); wouldn't this be eq q{''}?
Say again?
Where I was so lost as to why I couldn't get my string to popup. [...] Where the result is not readable, this string is displayed as is.
What? You just said the same piece of code didn't display the message and displayed it as-is.
In reply to Re^3: Perl, JavaScript and quoting/escaping
by ikegami
in thread Perl, JavaScript and quoting/escaping
by isync
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |