iLTC Home
Bookmark iLTC!
iLTC Google Boards

Google Groups
Receive The Code in Email!



Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • I bookmarked this site...
    125,000

    iLoveTheCode.com
    Perl > Perl Tutorials How To Easy > Use the Perl PRINT FUNCTION

    Use the Perl PRINT FUNCTION



    There are two ways to PRINT to your browser or terminal. Luckily, whether you are using a CGI script for the web, or you are running Perl on the command line, PRINT works the same way.

    The PRINT FUNCTION Example 1:


    $city2="Paris";

    print "I saw \"London\", and it cost me \$40.00 to take the Chunnel to $city2.<br>chris\@ilovethecode.com";

    Which prints:
    I saw "London", and it cost me $40.00 to take the Chunnel to Paris.
    chris@ilovethecode.com


    Inside of the double quotations, COMMENT OUT $ @ and " with backslashes \

    We didn't COMMENT OUT the last $ because we wanted to print $city2 as a variable (Paris).


    The PRINT FUNCTION Example 2:


    $city2="Paris";

    print <<"H";

    I saw "London", and it cost me \$40.00 to take the Chunnel to $city2.<br>
    chris\@ilovethecode.com

    H


    Pretty much the same except... you can write quotation marks to your heart's content! You need not comment them out anymore!

    That might not seem like much, but it really does keep your code neater.

    NOTE: The H can be any letter or set of letters you like as long as the two match and they are followed by line returns.



    Copy and Paste Perl Script:

    #!/usr/bin/perl

    print "Content-type:text/html\n\n";

    $city2="Paris";

    print "I saw \"London\", and it cost me \$40.00 to take the Chunnel to $city2.<br>chris\@ilovethecode.com";

    print <<"H";

    <br><br>
    I saw "London", and it cost me \$40.00 to take the Chunnel to $city2.<br>
    chris\@ilovethecode.com

    H

    exit;




    Perl Print Function - See in Action (new window)


    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: INCREMENT and DECREMENT a Variable in Perl
    Next Article: OPEN and READ a Data File in Perl





    HTML & XHTMLHTML & XHTML

    Chuck Musciano, Bi...

    New $29.99

    Dreamweaver CS3Dreamweaver CS3

    David McFarland

    New $29.69

    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39

    CSSCSS

    David McFarland

    New $23.09

    Learning Web DesignLearning Web Design

    Jennifer Niederst ...

    New $26.99

    HTML, XHTML, and CSS, Si...HTML, XHTML, and CSS, Sixth Edition ...

    Elizabeth Castro

    New $23.09

    Creating Web SitesCreating Web Sites

    Matthew MacDonald

    New $19.77

    CSSCSS

    Eric Meyer

    New $29.69

    Bulletproof Web DesignBulletproof Web Design

    Dan Cederholm

    New $23.99


    Of Interest:
  • Add, Subtract, Multiply, and Divide in Perl
  • Getting Server Time in Perl
  • To Sort an Array in Perl
  • INCREMENT and DECREMENT a Variable in Perl
  • Call your Function in Javascript
  • Select All or Highlight Text Fields and Textareas Using Javascript
  • Javascript Pop - Use Pop to Remove Items from the End of an Array in Javascript
  • Getting Epoch Time in Javascript
  • HTML Status
  • HTML Space
  • HTML Title Tag
  • HTML Frames

  • More Articles:
  • OPEN and WRITE a Data File in Perl
  • To Sort an Array in Perl
  • To Reverse an Array in Perl
  • What's in an Array, Index Numbers
  • onClick Javascript
  • Close Window with window.close in Javascript
  • Annoy Users with onBlur in Javascript
  • Select All or Highlight Text Fields and Textareas Using Javascript
  • Use onMouseOut in Javascript
  • HTML Underline Text
  • HTML Tags
  • HTML Color Codes
  • HTML Body Tag

  • Search iLTC w/ Google





    Recent Articles

  • Javascript Focus Form Field
  • Javascript Lowercase Text
  • Javascript Uppercase Text
  • Javascript Superscript Text
  • Javascript Subscript Text
  • Make Text Blink Using Javascript
  • Make a String into a Link in Javascript
  • Javascript Italics Text
  • Javascript Bold Text
  • Javascript Redirect
  • HTML Frames
  • HTML Color Chart
  • HTML Link
  • Javascript Status Bar








  • Perl Programming - Javascript Programming - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006 iLoveTheCode.com


    Contact Chris | About this Site


    421,765
    Counter by iLoveTheCode.com


    Last Modified: Friday, 23-Jun-2006 07:23:18 EDT