Hi,
I have perl script which is calling an external command using "system()" with argument.
But i am not able to capture the output.Even tried with backtick also with no luck.
.
.
$number=<>;
system ("cmd $number >output.txt");
Hi,
I have perl script which is calling an external command using "system()" with argument.
But i am not able to capture the output.Even tried with backtick also with no luck.
.
.
$number=<>;
system ("cmd $number >output.txt");
<> leaves in the newline, so your command ends up as
"cmd something
> file.txt"
Try:
$number=<>;
chomp($number);
system("cmd $number > out.txt");
Remember, when in doubt, print your string to see if it's actually what you think it is.
Yes. After "chomp" the input it works fine.
Thanks