Help for this page

Select Code to Download


  1. or download this
    # Build a hash of word counts
    foreach ( map @$_, @all ) { $words{$_} ++ }
    
    # Create a list of arrays showing repeats
    @out = map { [ map $words{$_} > 1 ? 1 : 0, @$_ ] } @all;
    
  2. or download this
    # List processing with foreach/push  
    foreach ( @input ) {
      push @out, lc($_);
    ...
    
    # Equivalent "rolled-up" map expression:
    print map { lc($_) } @input;