unclescrooge schreef:
> #!/usr/bin/perl
Missing:
use strict;
use warnings;
> use CGI::Carp qw(fatalsToBrowser);
>
> require "subparseform.lib";
What is that?
> &Parse_Form;
Don't put a & in front of a sub-call, unless you know why.
If you meant Parse_Form(@_), then write it like that.
(see `perldoc perlsub`)
> $data_file="trouble.cgi";
> open(DAT, $data_file) || die("Could not open file");
> @raw_data=<DAT>;
> close(DAT);
That way wastes memory, there is often no need to slurp all the lines
into an array.
And use a lexical variable to hold the filehandle.
>
> print "Content-type: text/html\n\n";
> print "<HTML><BODY>";
>
> foreach $site(@raw_data)
> {
> chop($site);
s/chop/chomp/
> ($reporter,$problem,$mrttech)=split(/\|/,$site);
> print "$reporter $problem $mrttech ";
> print "<BR> \n";
> }
Whitespace is cheap, improve on your indentation.
> print "</BODY></HTML>";
So try to make it look more like this
#!/usr/bin/perl
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
require "subparseform.lib";
Parse_Form();
my $data_file = "trouble.cgi";
{
open my $fh_data, "<", $data_file
or die "Could not open '$data_file': $!";
print "Content-type: text/html\n\n";
print "<html>\n<body>\n";
while (<$fh_data>) {
chomp;
my ($reporter, $problem, $mrttech) = split /\|/;
print "r[$reporter] p[$problem] m[$mrttech]";
print "<br />\n";
}
print "</body>\n</html>\n";
}
__END__
(untested)
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/