|
-
Feb 3rd, 2004, 11:28 AM
#1
Thread Starter
Frenzied Member
[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 .= "$_";
}
}
-
Feb 4th, 2004, 02:15 PM
#2
Addicted Member
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).
Travis, Kung Foo Journeyman
Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
OSS: Mozilla, MySQL (Manual)
-
Feb 4th, 2004, 05:35 PM
#3
Thread Starter
Frenzied Member
thanks alot for the code.. ill see if it works
-
Feb 4th, 2004, 07:15 PM
#4
Thread Starter
Frenzied Member
it didnt work. replaced the whole page oddly enough.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|