Sharan Basappa 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.
>
> I have done the following but when I execute the script, I get no output.
>
> Is there an issue I am overlooking ?
>
> Another question is whether perl will replace the variable defined in
> the embedded text with actual values ?
>
>
> #!/usr/bin/perl
> my $one = "onex";
> my $two = "twox";
> while (<MY_BLOCK>)
> {
> print $_;
> }
> exit;
>
> __MY_BLOCK__
> once
> upon
> there was a person who was
> very fond of $one and $two
That will work if you change <MY_BLOCK> to <DATA> and change __MY_BLOCK__ to
either __DATA__ or __END__ or alternatively use the Inline::Files module.
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/