in reply to Re^2: Perl, JavaScript and quoting/escaping
in thread Perl, JavaScript and quoting/escaping
[ 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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl, JavaScript and quoting/escaping
by Anonymous Monk on May 06, 2011 at 01:49 UTC | |
|
Re^4: Perl, JavaScript and quoting/escaping
by Anonymous Monk on May 06, 2011 at 01:53 UTC | |
by ikegami (Patriarch) on May 06, 2011 at 05:09 UTC | |
by Anonymous Monk on May 06, 2011 at 06:03 UTC | |
|
Re^4: Perl, JavaScript and quoting/escaping
by Anonymous Monk on May 06, 2011 at 02:08 UTC | |
by Anonymous Monk on May 06, 2011 at 03:15 UTC | |
by Anonymous Monk on May 06, 2011 at 03:39 UTC |