in reply to Programming Language to generate Perl Scripts

Welcome to the Monastery. Based on the information given the obvious answer is Perl, however perhaps your approach isn't right, could explain exactly what you want to do/automate? See How do I post a question effectively?.

  • Comment on Re: Programming Language to generate Perl Scripts

Replies are listed 'Best First'.
Re^2: Programming Language to generate Perl Scripts
by samaadhi (Initiate) on May 14, 2010 at 15:40 UTC
    Hey, sorry about that. Basically, I have an XML file. I need to parse this file, get the attributes and elements and use them to generate multiple perl scripts. My question is, what programming language would be the best to do this? It doesn't seem right to use perl to generate perl scripts as it will become very messy.

      Use Perl and the module XML::Twig to parse your XML file. Do you actually need to generate separate perl scripts or simply perform a fuction based on values within your XML file?

      "It doesn't seem right to use perl to generate perl scripts as it will become very messy."

      What makes you think this would be any easier in another language?

      Update: fixed typo

        I need to generate separate perl scripts, based on the values within the XML file. I am a n00b to perl. What do I need to do say if I want to write $samaadhi(not the value, the text) into a file.

        Wouldn't it be a mess of single quotes and double quotes? Still giving a thought of using perl. XML::Twig seems cool.

      Perl has multi-line strings, customisable string delimiters (e.g. qq!!) and even nestable string delimiters (e.g. qq{}), making it a great language to use to generate code. It also has strong templating and XML parsing tools. It would truly be an excellent choice.

      What makes you think it would not be messier in any other language?

      Perl is good at this sort of data munging, and has stuff like eval built right in!