-
[perl] pulling variables
Perl questions:
In my code I have the variable $custidno
now i take a file into a string, and I print it onto
the page, in this file there is the take $custidno.
the problem is, that it actually shows up in that form on the paper (the variable is not inserted if you read it from the file. )
How would I read it in such a way that it gets the proper value.
(not PHP: PERL)
PHP Code:
sub get_page {
open TL, "templates/cargo.htm"
or die "Template not found! ($!)";
while (<TL>) {
$html .= "$_";
}
}
-
It is easier to understand your question if you attempt proper grammar. Either use English, or use another language, but don't use both.
I'm guessing:
Code:
sub get_page {
open TL, "templates/cargo.htm" or die "Template not found! ($!)";
while (<TL>) {
$html .= s/(\$\w+)/$1/eeg;
}
}
You may only need one e, I'm not sure. Test it and see. This will replace any text in $_ that looks like a scalar variable ($custidno, $foo, etc).
-
thanks alot for the code.. ill see if it works
-
it didnt work. replaced the whole page oddly enough.