Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Misunderstanding Recursion

by Joost (Canon)
on Dec 20, 2006 at 02:40 UTC ( [id://590845]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    foo(1,2,3,4);
    
    sub foo {
      my (@args) = @_; # now @args holds a _copy_ of all the arguments
    }
    
  2. or download this
    sub foo {
      my $first = shift; # get the first argument and remove it from @_;
      my $last  = pop;   # get the last argument and remove it from @_;
    }
    
  3. or download this
    my $i = 1;
    inc($i);
    sub inc {
      $i++;  #note: $i is not declared and read from @_
    }
    
  4. or download this
    my $i = 1;
    inc($i);
    ...
      my $i = shift;  # declare and read $i from @_
      $i++;
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found