Thread: problem in file reading
Results 1 to 2 of 2
Related
-
xml file reading Forum: Javascript Forum
Replies: 0 -
Reading file from different HD Forum: CGI Perl Forum
Replies: 0 -
Regarding .XLS file reading and display Forum: CGI Perl Forum
Replies: 0 -
problem with excel file reading in Perl-Cgi Forum: CGI Perl Forum
Replies: 3 -
reading from text file to textarea using vbscript Forum: Website Scripts Forum
Replies: 0
-
08-31-2007, 09:28 AM #1
problem in file reading
hi...
i am beginner in perl cgi programming..i am atempting to read from a file....
my cgi script is
#!c:\perl\bin\perl -wT
#print "content-type: text/html \n\n";
use CGI qw(:standard);
use strict;
print header;
print start_html ("ebanking");
my $ne=param('name');
my $pwid=param('pwd');
open(FP,"input.txt") or die "cannot open file";
@raw_data=<DAT>;
close(DAT);
foreach $account (@raw_data)
{
chop($account);
($w_name,$pswd,$accno,$address,$type,$balance)=spl it(/\|/,$account);
if(( $ne eq $w_name) and ( $pwid eq $pswd))
{ print " \nName: $w_name Balance: $balance" ; }
else
{print "\n User name and password not match"; }
}#fore each
print end_html;
when the above code is executed using WIN 32 apache it shows an internal error...this is the syntax given in every website....
if i remove the print statements corresponding to cgi and run in command line perl it works perfectly....
please help...
-
10-14-2007, 10:56 PM #2
Re: problem in file reading
Hello,
Couple of things. If you remove the print statements then it will work, because you haven't declared the content type:
You use:
#print "content-type: text/html \n\n";
When it should be:
print "content-type: text/html \n\n";
Because you added a # at the beginning, perl reads that line as being a COMMENT not code
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum