$handle = popen('PerlCode.pl','w'); fwrite($handle,"here is some input\n"); fwrite($handle,"more input\n"); # etc.... pclose($handle); #### while () { # Do something with the line we just read }