DreamT has asked for the wisdom of the Perl Monks concerning the following question:

So, I have 2 files: file.pl, that is a script that posts an xml call to a certain service, and file.dat, that is a template file for the xml posting.

Everything works just fine, but due to distribution reasons i'd like to include the template in the script. The obvious solution is to include the template in a variable, but I want to do it in a more easy managed way.
Any suggestions?

Replies are listed 'Best First'.
Re: Template file include in code?
by moritz (Cardinal) on Oct 22, 2009 at 14:57 UTC
    See the description of the DATA file handle in perldata.
    Perl 6 - links to (nearly) everything that is Perl 6.
      Ok! Is it availabel for Perl 5 as well?
        The perl6 bit is just his sig.
Re: Template file include in code?
by tswall (Monk) on Oct 22, 2009 at 17:27 UTC
    May I offer an example, my esteemed monks?

    use strict; use warnings; print <DATA>; __DATA__ <myXML> <myData>This is some data.</myData> </myXML>