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...
    123,714

    iLoveTheCode.com
    Perl > Perl Tutorials How To Easy > Passing a Variable or Value to a Subroutine in Perl

    Passing a Variable or Value to a Subroutine in Perl



    To pass a value to a subroutine in Perl:

    &gy("Hiya");

    sub gy {
    print "$_[0]";
    }


    Which Prints:
    Hiya


    -We called, or executed, the subroutine gy and passed the value Hiya.
    -When a subroutine is called, whatever is inside the parenthesis is accessible in the built-in variable $_[0]
    -In our subroutine gy we said to print whatever is passed to it.



    Copy and Paste Perl Code:

    #!/usr/bin/perl

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

    &gy("Hiya");

    sub gy {
    print "$_[0]";
    }

    exit;



    Resources:
    Create a Subroutine in Perl


    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Create a Subroutine in Perl
    Next Article: Getting What is Matched in Perl





    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39

    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

    New Perspectives on HTML...New Perspectives on HTML and XHTML 5...

    Partrick Carey

    New $67.45

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

    Louis Rosenfeld, P...

    New $26.39

    HTMLHTML

    Gary B. Shelly, Th...

    New $84.55

    HTML & XHTMLHTML & XHTML

    Chuck Musciano, Bi...

    New $29.99

    CSSCSS

    Eric Meyer

    New $29.69

    CSS MasteryCSS Mastery

    Andy Budd, Simon C...

    New $23.85


    Of Interest:
  • Substitute in Perl
  • Use the Perl PRINT FUNCTION
  • OPEN and WRITE a Data File in Perl
  • What's in an Array, Index Numbers
  • Passing an Argument or Variable to a Javascript
  • Get Formatted Time in Javascript
  • Splitting an Array using Javascript
  • Javascript Focus Form Field
  • HTML Status
  • Make a Line Return Using HTML
  • HTML Body Tag
  • HTML Underline Text

  • More Articles:
  • Matching with a Regular Expression, REGEX, in Perl
  • Exit a Script or Subroutine in Perl
  • Putting Two Strings Together, Concatenate
  • Encryption with the Crypt Function in Perl
  • onClick Javascript
  • Change a Form Field with Javascript
  • Exit a For Loop in Javascript with Break
  • Use onLoad to Call More than One Function with Javascript
  • Use innerHTML to Change Text on a Page
  • HTML Font Code
  • HTML Tables
  • HTML Center
  • 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


    420,475
    Counter by iLoveTheCode.com


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