while( my $word = ){ chomp $word; last if $word eq 'done'; $counter{$word}++; }