Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://575932]
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: (5)
As of 2016-10-28 23:40 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (387 votes). Check out past polls.