There is no spoon.

Seriously though, JavaScript is parsed, not executed (similar to perl, but not). You have to provide a link to an actual file containing JavaScript commands that your browser's JavaScript parsing engine can understand and properly parse. Passing it a Perl script will do nothing, except cause the internal browser JavaScript parser to silently abort with an error (unless you have a browser with a JavaScript debugging console). The browser's internal JavaScript parsing engine doesn't understand how to properly parse perl constructs (thankfully), and leaves it alone.

Also, even if that could work, your perl script is redundant, since you're already passing a Content-Type when your webserver sends the .html page to the client, and you then parse a perl script which passes it again, right in the middle of existing content.

In short, use the Perl interpretor to interpret perl, and the JavaScript interpretor to interpret JavaScript.

How about using this instead, less code, easier to maintain:

#!/usr/bin/perl use strict; # ALWAYS use strict use CGI qw(p br); my $cgi = CGI->new(); print $cgi->header(); print $cgi->start_html(-title=>'Welcome'), "\n"; print p('Acesta este pagina de index si mai jos se afla legatura facuta la test.pl'); print p('Acesta este continutul fisierului'), br(); print $cgi->end_html();

You could also do this all in one print statement, if you wish:

#!/usr/bin/perl use strict; # ALWAYS use strict use CGI qw(p br); my $cgi = CGI->new(); print $cgi->header(), $cgi->start_html(-title=>'Welcome'), "\n", p('Acesta este pagina de index si mai jos se afla legatura facuta la test.pl'), p('Acesta este continutul fisierului'), br(). $cgi->end_html();

TMTOWTDI


In reply to Re: Problem to include a perl file by hacker
in thread Problem to includ a perl file by webstudioro

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.