Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a perl script from within which I need to call an .exe and pass a param and grab the return value. The problem is that the .exe issues a prompt and from with a shell script I would normally use a here document to pass the parameter
This produces a reference number. e.g. 07F1E07F0007F0C#!/bin/ksh myexe <<-EOF param1 EOF
I don't have the source for myexe (a C program) but am required to use it's output. However from within the perl script I am not sure how to achieve the same thing. The current relevant perl code looks like this
This doesn't work . It's producing garbage in $result so I am assuming it's not being passed to myexe properly. Any help on this would be most welcome. I'm not a prolific perl programmer.my %NameAlreadyProcessed; for my $i (0 ..$#{$Details}) { my $Name = $Details->[$i][0]; my $contact = $Details->[$i][1]; next if $NameAlreadyProcessed{$Name}; $NameAlreadyProcessed{$Name} = 1; my $result = qx{ myexe $contact }; print "$Name $result\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: passing params to an exe in a perl script
by Anonymous Monk on Jul 05, 2012 at 11:18 UTC | |
by Anonymous Monk on Jul 05, 2012 at 11:29 UTC | |
by Anonymous Monk on Jul 05, 2012 at 11:44 UTC | |
by ww (Archbishop) on Jul 05, 2012 at 12:08 UTC |