The formation or suppression of particular structures is a major change occurring in development and evolution. One example of such change is the absence of the seventh abdominal segment (A7) in Drosophila males. We show here that there is a down-regulation of EGFR activity and fewer histoblasts in the male A7 in early pupae. If this activity is elevated, cell number increases and a small segment develops in the adult. At later pupal stages, the remaining precursors of the A7 are extruded under the epithelium. This extrusion requires the up-regulation of the HLH protein Extramacrochetae and correlates with high levels of spaghetti-squash, the gene encoding the regulatory light chain of the non-muscle myosin II. The Hox gene Abdominal-B controls both the down-regulation of spitz, a ligand of the EGFR pathway, and the up-regulation of extramacrochetae, and also regulates the transcription of the sex-determining gene doublesex. The male Doublesex protein, in turn, controls extramacrochetae and spaghetti-squash expression. In females, the EGFR pathway is also down-regulated in the A7 but extramacrochetae and spaghetti-squash are not up-regulated and extrusion of precursor cells is almost absent. Our results show the complex orchestration of cellular and genetic events that lead to this important sexually dimorphic character change.