Help for this page

Select Code to Download


  1. or download this
    while (<RESULT>){
        @my_data=<RESULT>;
        print "@my_data\n"
    }
    
  2. or download this
    @my_data = <RESULT>;
    
  3. or download this
    <RESULT>; # reads a line from RESULT
    @my_data = <RESULT>; # reads rest into @my_data
    
  4. or download this
    while (<DATA>) {
      chomp;
    ...
      for (@cells) { s/^"(.*)"$/$1/ }
      ...
    }
    
  5. or download this
    File A:
    ALABAMA                         AL
    ...
    Florida     Tallahassee
    Georgia     Atlanta
    ...
    
  6. or download this
    my %data;
    open(A, '<', 'fileA');
    ...
      $data{lc($cells[0])} = [ @cells ];
    }
    close(A);
    
  7. or download this
    open(B, '<', 'fileB');
    while (<B>) {
    ...
      my $data_from_a = $data{lc($cells[0]} || [];
      print join("\t", @cells, @$data_from_a), "\n";
    }
    
  8. or download this
    Alabama Montgomery      ALABAMA AL
    Alaska  Juneau  ALASKA  AK
    ...
    California      Sacramento      CALIFORNIA      CA
    Colorado        Denver  COLORADO        CO
    ...