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



  • Pass the Javascript, please...
    142,991

    iLoveTheCode.com
    Perl > Perl Tutorials How To Easy > Create a Subroutine in Perl

    Create a Subroutine in Perl



    Creating a subroutine in Perl is fairly easy...

    sub gy {
    print "Hiya";
    }

    &gy;

    Which Prints:
    Hiya


    -You can name your subroutine pretty much whatever you like. Here, we named it gy
    -We called, or executed, our subroutine with &gy;
    -Whenever called, our subroutine will print Hiya

    NOTE: We could have placed the &gy; before the subroutine itself and everything would work just as well.



    Copy and Paste Perl Code:

    #!/usr/bin/perl

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

    sub gy {
    print "Hiya";
    }
    &gy;

    exit;


    Resources:
    Passing a Variable or Value to a Subroutine in Perl


    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Finding the Length (Index Numbers) of an Array in Perl
    Next Article: Passing a Variable or Value to a Subroutine in Perl





    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39

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

    Elizabeth Castro

    New $23.09

    CSS MasteryCSS Mastery

    Andy Budd, Simon C...

    New $23.85

    Bulletproof Web DesignBulletproof Web Design

    Dan Cederholm

    New $23.99

    JavaScriptJavaScript

    David Flanagan

    New $31.49

    Information Architecture...Information Architecture for the Wor...

    Louis Rosenfeld, P...

    New $26.39

    Head First HTML with CSS...Head First HTML with CSS & XHTML

    Eric Freeman, Elis...

    New $23.99

    New Perspectives on HTML...New Perspectives on HTML, XHTML, and...

    Patrick Carey

    New $69.26


    Of Interest:
  • OPEN and READ a Data File in Perl
  • Add to End of an Array with Push in Perl
  • INCREMENT and DECREMENT a Variable in Perl
  • Check for Existing File in Perl
  • Make Text Blink Using Javascript
  • Annoy Users with onBlur in Javascript
  • Call your Function in Javascript
  • Get String Length with Javascript
  • HTML Space
  • HTML Title Tag
  • HTML Body Tag
  • Make Strikethrough Text Using HTML

  • More Articles:
  • Matching at the Beginning and End 2
  • To Reverse an Array in Perl
  • What Environmental Variables are Available
  • Write a WHILE LOOP in Perl, Carefully
  • onClick Javascript
  • Get Query String Using Javascript
  • If, Else If, and Else in Javascript
  • Use onClick in Javascript
  • Close Window with window.close in Javascript
  • HTML Background
  • Make Strikethrough Text Using HTML
  • HTML Forms
  • HTML Color Codes

  • 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


    439,756
    Counter by iLoveTheCode.com


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