The film was to be made with Nargis and Madhubala in the roles Mala Sinha and Waheeda Rehman played eventually. However the two actresses were unable to decide which role they wanted to play and Guru Dutt eventually opted for two then new actresses, Mala and Waheeda.
The trivia item below may give away important plot points.
There was an disagreement between the writer Abrar Alvi and Guru Dutt regarding the ending of the movie. The writer did not believe in Vijay (played by Guru Dutt) leaving the society in which he was living and he should fight the ills of society( as the same disagreeable values are found in other societies too). However, Guru Dutt stuck to his point and finally the writer had to yield.