Help for this page

Select Code to Download


  1. or download this
    while(<DATA>){
    chomp;
      $hash{$_}++ for split;  
    }
    
  2. or download this
    while(<DATA>){  #get a line of text from the DATA area, put it in spec
    +ial variable $_
        chomp;      #remove the "new line" character from the $_ variable
    ...
            $hash{$word}++;  #increment the value pointed to by the $hash{
    +$word} "key"
        }  
    }
    
  3. or download this
    board => 1
    chalk => 1
    ...
    students => 2
    table => 1
    teacher => 3
    
  4. or download this
    foreach $word (sort keys %hash) {
        print "$word\n";
    ...
            print "$word\n";
        }
    }