how to embed data in perl programs



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 ?

Thanks ..

#!/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


Relevant Pages

  • Re: Can Perl do this task???
    ... > I've tried some hardware type interfaces in between but its difficult ... > I was thinking that I could create a perl program and via a pipe ... Try reading `perldoc perlipc` to see if what you want to do is listed in ... One for writing and one for reading. ...
    (comp.lang.perl.misc)
  • Re: Checking CPU temperature
    ... Is there some other program to check the CPU temperature? ... Since you get a reading ... I wrote a perl program to read those ... perfectly with the output of the gnome sensors applet. ...
    (Fedora)
  • Re: can someone help?
    ... You will get more help if potential answerers could tell what ... your post was about before reading all of it. ... What you intended to be a Perl program is not actually ... You have a syntax error in the code, but since you are the only ...
    (comp.lang.perl.misc)