Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: shift vs @_

by shmem (Canon)
on Oct 02, 2006 at 19:33 UTC ( #575932=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        # 1. non-destructive
        my $var = $_[0];                      # first element of @_
    ...
        # 2. destructive
        my $var = shift;                      # first element gets removed
    + from @_
        my ($foo, $bar) = map { shift } 1,2;  # two elements get removed f
    +rom @_
    
  2. or download this
    sub foo {
        my $foo = $_[0];
        my $quux = baz(@_)
        return $foo ^= $quux;
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-12-22 08:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (112 votes), past polls