0

I need to run perl script through tcl script, but exec command in tcl is not generating the results of perl script.

tcl script (test.tcl) has following line

exec perl test.pl

perl script test.pl has following lines.

use strict;
use warnings;
print "Have a nice day!!!";

I am running tcl through cmd window as "tclsh test.tcl". No errors and no output. Why it is so???

1

1 Answer 1

1

exec command will return the output of the program and you have to capture it by saving it into a variable, or straightaway print it using puts.

set result [exec perl test.pl]
puts $result
Sign up to request clarification or add additional context in comments.

2 Comments

However this code is not working when perl script generates a output file. Hence i used "exec perl test.pl" alone as code, but output file is not generated.
@SumathiGokul that sounds like quite a different question. Please ask a new one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.