in reply to piping a function into a backtick shell

You can open an output file which is a pipe to 'program', then 'print' the output of your funciton to that pipe, as in:
open PROG, "|program" or die "Can't open output pipe to 'program'"; print PROG function(); close PROG;
It's concise, and comes pretty close to the the goal of the code itself describing what's going on.

Update: Oops! It's also not what you were asking for. (Sorry, I didn't read carefully, and didn't see the backticks in your code in my browser's font. )

IPC::Open2, as Tanktalus suggests is the most concise approach under Unix. I haven't had success with IPC::Open2 under MSWindows, either XP or 98 (Perl v5.8.6 and v5.8.4 respectively). On MSWindows I think you're stuck writing to a temporary file, as in :

my $input = "first line\nsecond line"; open TEMP, '>' "temp$$"; print TEMP $input; close TEMP; my $ouput = `type temp$$|\\vim\\vim63\\xxd.exe`; print $output; unlink "temp$$"; # (tested)
If you're sure you won't have newlines or other troublesome characers in the '$input' data, then what you started with, using 'echo', is about as good as you'll get. (Now watch, as a much cleverer monk proves me wrong.)