Help for this page

Select Code to Download


  1. or download this
     chomp $_;
     my $line = $_;
    ...
       $_         # return the modified string
      }
     split '\s+', $line;
    
  2. or download this
     my @array = split;
    
  3. or download this
     print @array."\n"; # prints number of elements instead of whole array
    
  4. or download this
     print @array, "\n";
    
  5. or download this
     $hash->{$line_num}=@array; # does not works because of previous issue
    
  6. or download this
     $hash->{ $line_num } = \@array;
    
  7. or download this
     $hash->{ $line_num } = [ @array ];
    
  8. or download this
    while ( <FH> ) {
        $hash->{ $. } = [ split ];
    }
    
  9. or download this
    my @data;
    while ( <FH> ) {
        push @data, [ split ];
    }
    
  10. or download this
    my @data = map [ split ], <FH>;