wsnsecurity
Programmer
Hi there,
I am trying to call a python program that requires an argument at prompt within a perl script. Below is a few combinations that I have tried. It would call the program fine without the argument, but it wouldn't take the argument. The python program itself works fine. Could someone help with it? Thanks in advance.
YanYan
#!/usr/local/bin/perl
$file = 'host-list.txt'; # Name the file
open(INFO, $file); # Open the file
@DNSSer = <INFO>; # Read it into an array
close(INFO); # Close the file
$index = 0;
foreach $morsel (@DNSSer){
#@args = ("python dnspredict.py", @DNSSer[$index++]);
#print @args;
#system(@args) == 0
#or die "system @args failed: $?"
#system "python dnspredict.py", "@DNSSer[$index++]";
#exec "python dnspredict.py < @DNSSer[$index++]";
$SerIP = @DNSSer[$index++];
#print $SerIP;
exec "python dnspredict.py", "$SerIP";
}
I am trying to call a python program that requires an argument at prompt within a perl script. Below is a few combinations that I have tried. It would call the program fine without the argument, but it wouldn't take the argument. The python program itself works fine. Could someone help with it? Thanks in advance.
YanYan
#!/usr/local/bin/perl
$file = 'host-list.txt'; # Name the file
open(INFO, $file); # Open the file
@DNSSer = <INFO>; # Read it into an array
close(INFO); # Close the file
$index = 0;
foreach $morsel (@DNSSer){
#@args = ("python dnspredict.py", @DNSSer[$index++]);
#print @args;
#system(@args) == 0
#or die "system @args failed: $?"
#system "python dnspredict.py", "@DNSSer[$index++]";
#exec "python dnspredict.py < @DNSSer[$index++]";
$SerIP = @DNSSer[$index++];
#print $SerIP;
exec "python dnspredict.py", "$SerIP";
}