Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: shift vs @_

by Anonymous Monk
on Oct 03, 2006 at 08:27 UTC ( #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
Node Status?
node history
Node Type: note [id://576013]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2015-07-04 06:18 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 (57 votes), past polls