Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Turning foreach into map?

by polettix (Vicar)
on Apr 05, 2005 at 09:55 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://444917]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2024-04-19 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found