in reply to manipulation of ps command output

While matija has your bugfix, you could try the line-by-line approach:
open PS, 'ps -ef -o pid,ppid,pgid,user |' or die; while (<PS>) { tr/ //s; s/^ //; print; } close PS or die;
but I think what you really want is split and join (or $" or $,). Some golfing gives:
#!/bin/sh ps -ef -o pid,ppid,pgid,user | /usr/bin/perl -lape '$_="@F"'

-- 
LP^>