Hi I am Very New to Perl. Learning perl online from last 2 to 3 days.

My question is:

How to run perl script as CGI in Ubunut machines I have tried it but didn't got succeed . Please help me.

I have googled it but didn't find many supporting tutorials for it.
Gone through one of the tutorial i have done exactly the same, But didn't worked.

Thank you all for your reponsese.
Here I am going to update my question.

I have kept my file at /var/www/cgi-bin/ and i have made following changes in /etc/apache2/apche2.conf

Alias /cgi-bin /var/www/cgi-bin/ <Directory /var/www/cgi-bin> AllowOverride None AddHandler cgi-script pl cgi Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory>
I have restarted Apache. found following error on apache error logs

attempt to invoke directory as script: /usr/lib/cgi-bin/ . When I have accessed through Url. And found following error on page
You don't have permission to access /cgi-bin/ on this server.
Though I have given the 0777 permission for directory "cgi-bin".

http://localhost/cgi-bin

I have kept my file "test.pl" under "cgi-bin" and when I am accessing it through URL. its giving 404 error.

code of test.pl
###Start### #!/usr/bin/perl print "Hello world"; ###End###

please help.
Thanks in Advance..!!!

In reply to To Run perl through CGI by sidvanga

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.