in reply to $_[0] as a filehandle
use FileHandle; sub in { $_[0]->getline } sub out { $_[0]->print(@_[1..$#_]) } out \*STDOUT, in \*STDIN; [download]