Version 5 of Ways to execute Perl programs from Tcl

Updated 2001-10-18 21:11:51

There are several ways to execute Perl programs from Tcl applications. Most succinct is simply to apply Tcl's powerful exec in a command such as

    exec my_program.pl

[Explain open, and other IPC, more generally.]


It's quick work in Tcl to code a

    proc perl_interpret scripte {
        return [exec perl << [uplevel [list subst -novariables -noback $script]]]
    }

which allows one to write

    set a 13
    set b 79

     puts [perl_interpret {
        $result = [set a] + [set b];
       print "The sum is ", $result, ".\n";
     }]


Tclperl is quite nice. So is the Perl widget, although in a much different way.