shadowline
Escape Code << Print >> Chomp/Chop
The PRINT command in Perl is probably the most known and used. It is used to display things to the monitor screen.

I will start with the famous "Hello World!". Why is this the starting page for everyone to create? Oh well, who am I to mess with a good thing? LMAO! If you are unfamiliar with this concept... this is an extremely simple page/script that will print the words "Hello world!" on the screen.

Print is a built in Perl function. It sends output to a specific location. The location is "STandarD OUTput" also known as STDOUT. For the rest of us common folks, that means "the monitor screen". The print command is specific to the monitor screen, so stating an actual <STDOUT> command is unnecessary.

Ready for the code?

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print ("Hello World!");


See it in action!


The first line (shebang) tells the coding where to find the Perl translator. You should have read about this back on the BASICS page. The second line tells the browser that this PERL is working on the Internet. The last line states to print the following message. By default, it assumes STDOUT so the message will appear on the monitor screen.

The PRINT command is actually a very powerful one. It can be used to display parts of a web page using HTML coding, or even an entire web page! That circumstance is probably a bit out of the ordinary, but the possibilities are there.

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><head><title>Test</title></head><body>\n";
print "<h1>Hello world!</h1>\n";
print "</body></html>";


See it in action!


You will find the PRINT command rather handy as the tutorials go further.
Escape Code << Print >> Chomp/Chop
shadow

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads
shadow
shadow