I have a exe file named file.exe When it is run through command line, it takes some data and process it and creates an output file.
I want to feed data to file.exe within a perl script and want the output file.

Please let me know the commands to do it. I am using windows operating system. I was reading about pipes, but unable to find the solution.

Hi PhoenixInsilico,
Using perl inbuilt function system(...), you could do want you want. But really i don't know how you are feeding in your data into the executable file.
Below is an example. A simple C file to get a number from CLI. The file is complied as file.exe, and the Perl program that runs it is called file_exe.pl.

C Program file --- file.c

 #include <stdio.h>

int main(void){

    int number;

    printf("Enter your Value: ");
    scanf("%d",&number);  
    printf("%d\n",number);
    return 0;
}

Perl Program --- file_exe.pl

#!/usr/bin/perl -w
use strict;

my $exe_file = 'file.exe';

system( $exe_file );

Now running your Perl script, it just be as if you are using your normal CLI. You need not border about the output since your executable file has taken care of that.
Use as a guide. I hope it helps.

If you want to capture the output of the command/another program, use

$output=`COMMAND_TO_BE_EXECUTED`;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.