I ate a ripe guava, rife enough to be broken with hand, i later saw that it has white worms with one black end crawling inside it, are these worm harmful, i had unripe guava of same batch though most of them had small black spot inside, but no worm crawling, what are these crawling worms, were they present in guava from unripe stage or infected only after ripening ?
It is a safe bet that a "worm" as you describe in a ripe guava or any other ripe sweet fruit is a fruit fly.
Fruit flies are attracted to any ripe sweet fruit. They are also attracted to vinegar and alcohol - both produced by yeast in and on the fruit, which is the high protein food that the fruit flies are really after in the fruit.
When ripe, guavas emit a pungent, musky odor that attracts fruit flies. Fruit flies lay their eggs beneath the fruit's skin, and the maggots feed on the flesh. The damage causes guavas to rot. Fruit fly infestations often spread quickly, but prompt treatment can get populations under control.
The fly large actually speed the rotting of the fruit by moving yeast around on their bodies.