if ( ! $seen_in_file{$word} ) { $index{$word} .= ":" if ( exists( $index{$word} )); $index{$word} .= $file_id; $seen_in_file{$word}++; }