Help for this page

Select Code to Download


  1. or download this
      my @rows = map { chomp; [ split /;/ ] } <>;
      # now you have an array of arrays (rows of columns)
    ...
      for ( @rows ) {
        print "@{$_}[ @non_zero_columns ]\n";
      }
    
  2. or download this
      my %zero_columns;
      @zero_columns{ 0 .. $#{$rows[0]} } = (); # initially, all columns mi
    +ght have 0.
    ...
      my @non_zero_columns = grep {
        ! exists $zero_columns{$_}
      } 0 .. $#{$rows[0]};