Hello,
I 'm quite new to Perl, and have a problem with a parse function I found. It parses an html page, and passes on the values of the variables in a cgi script to the html page. Problem is, my ISP requests that i use "use strict", and the parse subroutine (see below) does not seem to like that:
# parse_file opens and prints a template file, substituting %%var%% for the
# value of $var:
sub parse_file {
open (FILE, $_[0]) or error("$_[0]: $!\n"
while (<FILE>) {
s/%%(\w+)%%/${$1}/ig;
print;
}
close (FILE);
return;
}
I get the error message:
Can't use string ("artnr" as a SCALAR ref while "strict refs" in use.
This seems logical when I think about it, but leaves me with the problem of having to find another solution to pass the variables on to the html page. I have been looking around, but could not find something as of yet.
Any suggestions would be very helpful.
Thanks,
Korneel.
I 'm quite new to Perl, and have a problem with a parse function I found. It parses an html page, and passes on the values of the variables in a cgi script to the html page. Problem is, my ISP requests that i use "use strict", and the parse subroutine (see below) does not seem to like that:
# parse_file opens and prints a template file, substituting %%var%% for the
# value of $var:
sub parse_file {
open (FILE, $_[0]) or error("$_[0]: $!\n"
while (<FILE>) {
s/%%(\w+)%%/${$1}/ig;
print;
}
close (FILE);
return;
}
I get the error message:
Can't use string ("artnr" as a SCALAR ref while "strict refs" in use.
This seems logical when I think about it, but leaves me with the problem of having to find another solution to pass the variables on to the html page. I have been looking around, but could not find something as of yet.
Any suggestions would be very helpful.
Thanks,
Korneel.