I think that's what holli has in mind. You could use a piped open (or open2 or open3) to write to your copy command's stdin.
Update: Looks like borisz has a better idea with DBD::Pg's COPY support.
--
Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ? (Missquoting Janis Joplin)