Help for this page

Select Code to Download


  1. or download this
    my @squares := apply { $_ * $_ } 2..5;
    
    ...
    {
        return func($head), apply(&func <== @tail);
    }
    
  2. or download this
    my @squares = apply(sub{$_[0] * $_[0]}, \(2..5));
    
    ...
        my($sub, $refArray) = @_;
        return map {$sub->($_)} @$refArray;
    }