open SHELL, "| bash.exe" or die "can't open the shell: $!"; print SHELL "type C:/temp.ml | ocaml > C:/output.txt\n"; print SHELL "dir C:/output.txt\n"; # and so on... #### open TEMP, "C:/temp.ml" or die "C:/temp.ml: $!"; open CAML, "| ocaml > C:/output.txt" or die "can't run ocaml: $!"; while () { print CAML } close CAML; open TXT, "C:/output.txt" or die "C:/output.txt: $!"; while () { # do other stuff }