You are not allowed to "open" to a command that pipes both in *and* out, but see IPC::Open2, IPC::Open3, "Bidirectional Communication with Another Process" in perlipc for alternatives.