my $arref = (exists $index->{$word}) ? $index->{$word} : []; # if word in index, extract reference push(@{$arref}, $recno); # add the new record number to the referenced array $index->{$word} = $arref; # put the reference back in the database