Jump to content
xisto Community
xsize

First Perl Programm My first Perl programm

Recommended Posts

I wonna show you my first perl programm:

[br]#!/usr/bin/perl[/br]# See Log file[br][/br]print "Content-type: text/html\n\n";[br]print "<HTML><HEAD><TITLE>Mind of Perl</TITLE>";[/br]print "<head><body><p>";[br]print "<h1>Hay Cgi-BIn</h1>";[/br]print "</body></html>"[br]

if you have other perl script, post it in this topic.[/br]How write perl counter?

Share this post


Link to post
Share on other sites

How does it work? I started reading a book on pearl about 6 years ago but I didn?t finish it and forgot everything I learned. I assume the # denotes comment, ; for end of line. I recognize you are printing an HTML file. My questions are: how does the program know where to print? When and how does the program get executed, and does it show up automatically in your web browser or do you have to open the file first? I?ll probably get around to reading some stuff on my own soon enough but a discussion can be more fun then a book. :D

Share this post


Link to post
Share on other sites

That's cool - i'm just learning too. Now you can add CGI module, and makes life easier!! so you can replace things like "<br>" with br

not sure what the other benefits of it are ...

[br]#!c:\perl\bin\perl -w[/br]use CGI qw/:standard/;[br][/br]use CGI;[br][/br]print header;[br]print "<html>"; # unsure of the cgi rep for this.[/br]print br . "Hello" . p . hr . "World";[br]print </html>";[/br]

Share this post


Link to post
Share on other sites

Speaking of Perl Programing. This guy has a few examples.

http://www.scriptarchive.com/

I noticed the get call puts functionname.cgi?(input arguments) in the URL.
But would the Perl scripts have a .pl after the file name. Is functionname.cgi, some other file that interprets the perl script? How do you create it?

Maybe this will give me the answers I want.

http://www.cgi101.com/book/

Share this post


Link to post
Share on other sites

i'll make a tip for you, since i just went through some learning as well.#!c:\perl\bin\perl -wuse CGI qw/:standard/;this will also help with the Xisto website when you get going.1) you'll need to change the 1st line of your perl to: #!/usr/bin/perl -w2) make sure you keep using the CGI init the way you are... i spent about 3 hours trying to fix what was happening, and got really confused about it ... but i had use CGI qw(:standard) ; #-- BAD!!!i have no idea why, but it works fine on my computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.