Help for this page

Select Code to Download


  1. or download this
    my @sets;
    for my $x (1..3){
    ...
    }
    use Data::Dumper;
    print Dumper(\@sets);
    
  2. or download this
    my @sets = map {
      my $x = $_; # Copy outer loop variable
      my @products = map { $x ** $_ } (1..3);
      \@products;
    } (1..3);
    
  3. or download this
    my @sets = map {
      my $x = $_; # Copy outer loop variable
      [map { $x ** $_ } (1..3)];
    } (1..3);