> A perl-javascript question (?) :)
>
> I sometime code javascript in my scripts like:
>
> my $script=<<EOS;
> function foo {
> alert('message from foo\\n');
> }
> EOS
>
> then do :
>
> print $q->start_html(-script=>'$script');
>
> But this requires the "escapes" have to be "escaped" ... Does
> anyone have an alternative... IS there a "switch" in perl to
> "handle" this ?
You could do:
my $script =<<'EOS';
function foo {
alert('message from foo\n');
}
EOS
Which forces the 'here document' to be a single-quoted string. The
downside of this is that it is a single-quoted string, so you can't
interpolate variables, which sort of defeats the purpose of writing out
javascript from perl to begin with.
HTH,
-dave