Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Turning foreach into map?

by polettix (Vicar)
on Apr 05, 2005 at 09:55 UTC ( #444917=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub double_it { $_[0] *= 2 }
    my $x = 1;
    print "\$x is $x\n";
    double_it($x);
    print "\$x is now $x\n";
    
  2. or download this
    $x is 1
    $x is now 2
    
  3. or download this
    my ($url, @list) = @_;
    
  4. or download this
    sub links {
       my $url = shift;      # This removes the first element of @_
       map { "$url/$_" } @_; # You don't need return :)
    }
    
  5. or download this
    sub some_func {
       # ... some stuff?
       my ($foo, $bar, $baz) = @_;
       # ... other stuff
    }
    
  6. or download this
    sub some_func {
       my $self = shift;
    ...
       my ($foo, $bar, $baz) = @_;
       # ... other stuff
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2020-07-09 21:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?