I'm wondering if by knowing the center $Z(G)$ as well as $G/Z(G)$ one can deduce G.

I thought that you should be able to write $G=Z(G) \times G/Z(G)$, because every element either lies in the center or it does not, and central elements can always be "separated" from the rest by commuting e.g. to the left. Yet a bit of experimenting with GAP has shown that this is clearly not true, however I don't see my mistake and would be very grateful if anyone could point it out to me.