Help for this page

Select Code to Download


  1. or download this
    my $x = 100;
    my @y = (10, 20, 30);
    ...
    }
    local $" = ", ";
    print "\$x = $x\n\@y = (@y)\n";
    
  2. or download this
    # or:
    foreach my $n ($x, @y) {
        $n *= 2;
    }
    
  3. or download this
    map { $_ *= 2 } $x, @y;
    
  4. or download this
    grep { $_ *= 2 } $x, @y;
    
  5. or download this
    sub double {
        foreach(@_) {
    ...
    }
    
    double($x, @y);