Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: shift vs @_

by Anonymous Monk
on Oct 03, 2006 at 08:27 UTC ( [id://576013]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        sub my_map {
            my $special_thingy = shift;
    ...
                apply($special_thingy, $item);
            }
        }
    
  2. or download this
        my ($special_thingy, @list_of_items) = @_;
    
  3. or download this
        sub my_map {
            foreach my $item (@_[1 ..$#_]) {
                apply($_[0], $item);
            }
        }
    
  4. or download this
        sub my_map {
            for (my $i = 1; $i < @_; $i++) {
                apply($_[0], $_[$i]);
            }
        }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-26 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found