In addition to considering
JavaFan's insight above, you should probably review
perlipc, particularly
Avoiding Pipe Deadlocks. You may also consider using
IPC::Open2 or
IPC::Open3, both of which are core modules, instead of creating an intermediate temp file.