Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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?
[Discipulus]: I 'm always at 125%, and fontsize 12

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2017-09-26 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (293 votes). Check out past polls.

    Notices?