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
    }