Hi Tom,

What if I wanted to have multiple embedded (and separate) texts embedded
in my program. Are you saying that I can have only one text section and that
should have keyword DATA.
Actually when I wrote example, I assumed that double underscore tell the
parser
that a text section starts (so used my own name - my_block)

Thanks ..


On 2/6/07, Tom Phoenix <[EMAIL PROTECTED]> wrote:

On 2/6/07, Sharan Basappa <[EMAIL PROTECTED]> wrote:

> Question is how to embed text in a perl program instead of reading it
from a
> file
> or initializing the text in a string variable.

Are you looking for here-documents? Look in perlop under Quote and
Quote-like Operators to see the different ways of putting text data
into your program.

> Another question is whether perl will replace the variable defined in
> the embedded text with actual values ?

Do you mean double-quote interpolation? Here-docs normally
interpolate, but you can disable that (akin to single-quoting instead
of double-quoting).

> while (<MY_BLOCK>)

> __MY_BLOCK__

It looks as if you've seen the special DATA filehandle and the
__DATA__ marker; but those don't generalize like that. Nice try,
though. (If you change those back to DATA in your program, I think it
will do what you expected. Consider adding 'use strict' and 'use
warnings', though.)

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

Reply via email to