Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

(Subroutine) Arguments explained (sort of.)

by Andrew_Levenson (Hermit)
on Dec 12, 2006 at 20:06 UTC ( #589388=perltutorial: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict; #always and forever, amen.
    use warnings;  #or else.
    
    ...
    #@ARGV is an array containing the arguments supplied. We're taking the
    + first value.
    print "\n$argument"; 
    #This here will show you exactly what has been put into $argument.
    
  2. or download this
    
    $bar='Hello,';
    ...
    #will first print out the contents of $bar, then $baz because 
    #those are the arguments given.
    }
    
  3. or download this
    foo("square", 3);
    
    sub foo{
      my ($shape, $size) = @_;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://589388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2015-07-07 01:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls