http://www.perlmonks.org?node_id=1050470


in reply to Re^2: I want to call a special xterm to execute "ls" command in a perl script
in thread I want to call a special xterm to execute "ls" command in a perl script

Perl cannot normally control other applications' terminals, so you'll have your application to fork, then run the child process under xterm, then use Expect module to pass the "vst" command to the "TBTerm" program. Read perlop about quoting operators if you don't know how to quote your command properly.

Use something like this to run your application under xterm:

unless (-t STDIN) { # check whether STDIN is a terminal exec (qw/xterm -e/,$0); # assuming that your perl file is executab +le }
Do you really need to spawn another xterm? If not, you can simplify your application and avoid coping with returning text data from forked child process (read pipe, by the way), since Expect creates a virtual terminal (not visible as a graphical window, though) to run your application into.