Next generation elastic optical networks will very likely require dual polarization (DP) optical transmitter with inherent flexibility to dynamically change its baud rate and/or modulation format. We develop a prototype of compact flexible DP M-ary quadrature amplitude modulation (MQAM) optical transmitter and demonstrate its reconfigurability to accommodate baud rates ranging from 8 to 32 Gbaud/s using the same hardware. The prototype has another advantage in that the modulation format can also be dynamically changed from binary phase shift keying up to 64 quadrature amplitude modulation (QAM) for single and DPs, all over a single optical carrier. This allows the generation of variable data rate up to 384-Gb/s over a single wavelength. Experimental results show that for the most challenging setting of DP-64 QAM/32 Gbaud, the worst case values of error vector magnitude and bit error rate are 6.7 and 3×10−2 , respectively. For less stringent settings, i.e., lower baud rate and/or lower modulation format, forward error correction limit error free transmission is easily obtained. Further results are also reported to demonstrate transmitter flexibility and software definability, by measuring symbol streams showing instantaneous swapping between modulation schemes with a swapping time less than 10 symbols duration, i.e., 0.3 ns.