[Top] [All Lists]

Re: Interpolate variable in a __DATA__ block

Subject: Re: Interpolate variable in a __DATA__ block
From: Gunnar Hjalmarsson
Date: Mon, 31 Mar 2008 06:24:48 +0200
Newsgroups: perl.beginners

aneely@xxxxxxxxxxxxxx wrote:
Gunnar Hjalmarsson wrote:
Trudge wrote:

Now I know it can be done, so I will be exploring this method.

Not much to explore, really. Did you read the applicable Perl FAQ? Even if it provides this method, it doesn't exactly recommend it... Besides full-blown template methods, the FAQ suggests a couple of other methods, that usually are better, and so is here documents which you say you have been using.

I've gone through that FAQ and did discover some new things for me. My goal is to be able to have several variables interpolated in the __DATA__ block. As Rob suggested, maybe that is not possible with the method you provided?

Yes, with the /g modifier you can expand multiple variables that way.

Granted I only gave you a simplistic example to work with, so that may be why you offered that solution.

The reason I gave you that solution is that you asked for it. ;-)

Perhaps I'm just as well sticking with my current usage of here-docs.

Yeah, it sounds so to me, actually.

Gunnar Hjalmarsson

<Prev in Thread] Current Thread [Next in Thread>