Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIS 3 & Perl...pipes & redirection? Need help..

Status
Not open for further replies.

Foxfyre

Programmer
Mar 12, 2001
4
0
0
US
Hey guys, I'm running Perl on IIS 3 (yeah, I know, it sucks, I need Solaris), and I'm having problems with a program that calls up subscripts like this:

my $mainerror=system("type test1_main.dat | main_input.pl");
my $drivererror=system("type test1_drivers.dat | driver_input.pl");
my $vehicleerror=system("type test1_vehicles.dat | vehicle_input.pl");

In the orignal version of this, written for Unix, the cat command was used, which I replaced with type. I need to be able to pipe the contents of a text file to a script. Anyone know what I'm doing wrong?

Thanks
-Foxfyre
 
it'll work easier if you just use '<'. in both windows and unix, standard input will be changed to whatever follows the '<', and you needn't even say 'type' or 'cat'(but it doesn't really hurt). you can also redirect standard output the same way by using '>'. however, your problem is probly that the shebang line in your scripts is not being interpreted by windows, hence it isn't calling the scripts at all. so what you can do is explicitly call 'perl' before each one. the end product would look something like:[tt]
my $var = system(&quot;perl script.pl < file.txt&quot;);[/tt]

there may be better ways to do this, depending on the actual results you need, but if this works, go with it. &quot;If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top