Yes you can do this, i wouldnt recomend it. The 3 prong
connector is a hot, a
neutral which activates the light then the
switch to activate. As long as the wiring was the same in both, and both outlets were wired correctly IE the neutrals were on the right side and hot on left, you would be fine. Otherwise, you would short
neutral to hot.