develooper Front page | perl.beginners | Postings from April 2002

file handles in cgi

Thread Next
From:
mnp4
Date:
April 3, 2002 01:35
Subject:
file handles in cgi
Message ID:
20020403062241.22C0D78B5@blr.vsnl.net.in

hi, 
this is the perl script :  abc.pl(say) -- this is in my cgi-bin...

#!/usr/bin/perl
print "content-type: text/html\n\n"; 

open (IN, ">abc.txt");
$x = ($inputs{name});
print IN $x;  
close (IN);

open (IN, "abc.txt");
@arr = <IN>;
print @arr;
close (IN);

and this is the html ... abc.html(say) in the httpd/html ....

<html>
<head></head>
<body>

<form method="post" action="/cgi-bin/abc.pl">Enter the name: 
<input type="text" name="name"> 
<input type="submit" value="click">
</form>

</body>
</html>


 if i run the .pl from command prompt with perl abc.pl , i t works fine and the abc.txt is created..now if i delete the abc.txt and run the script from the browser, the abc.txt is not created at all. i think there is something else that i might have to configure to be able to use files in cgi...help please...

thanks,
Prats.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About