miracle.clam has asked for the wisdom of the Perl Monks concerning the following question:

Hi perl gurus out here, Does anyone have/aware of a cool conversion tool that converts TCL script to Perl script? I have these thousands of code in TCL and looking for a way to convert the whole code to Perl and I am not a perl expert. Any advice/help is highly appreciated! Thank you.

Replies are listed 'Best First'.
Re: Convert TCL script to Perl Script
by moritz (Cardinal) on Mar 13, 2012 at 14:38 UTC

    I don't know of such a translater, but that doesn't have to mean much.

    But experience shows that automatic code translators either don't work for big code bases, or produce unmaintainable code. Especially for two language that are based on so different principles as Perl and TCL.

    The only exception being languages which have been explicitly designed to be compiled to another language, like coffeescript, which is designed to be compiled to javascript.

Re: Convert TCL script to Perl Script
by raybies (Chaplain) on Mar 13, 2012 at 14:17 UTC
    Why convert to Perl if you're not a Perl expert? Won't that just give you more code you don't understand? Why not take the time to whatever language you are expert in, or learn TCL?
Re: Convert TCL script to Perl Script
by VinsWorldcom (Prior) on Mar 13, 2012 at 14:21 UTC

    Are you a TCL expert, if not a Perl expert? What is the TCL code for?

    I only ask as I know Perl much better than I know TCL but my last job required the use of TCL to interface with external devices for control as the vendors only supplied TCL libraries for their API. Existing TCL scripts and example TCL scripts were easily expanded for the limited functionality I needed.

    For me, it was easier to learn the limited TCL syntax I needed to get the job done than to convert the whole thing into Perl and use a module like Inline::TCL.

Re: Convert TCL script to Perl Script
by Anonymous Monk on Mar 13, 2012 at 14:11 UTC
Re: Convert TCL script to Perl Script
by LanX (Saint) on Mar 13, 2012 at 14:36 UTC
    IMHO this can't be simply done.

    AFAIK is TCL a fully interpreted language, whereas Perl has a compilation phase before interpreting the generated op-code.

    The differences might seem subtle but can cause severe problems.

    Cheers Rolf