CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
not running sub.

 



Gwidion
Deleted

Mar 31, 2001, 9:54 PM

Post #1 of 2 (209 views)
not running sub. Can't Post

ok trying to write an admin interface for a pasword script i wrote. i haven't finished it but already i have a problem, it doen't seam to want t orun the sub.

#!/usr/bin/perl
$count = 0;

open (LIST, "list.info");
@user = <LIST>;
close(LIST);

print "Content-type: text/html\n\n";
print qq|<html>
<head>
<title>Admin</title>
</head>
<STYLE>

</STYLE>
</HEAD>
<BODY BGCOLOR=000000 TEXT=9966CC LINK=9966CC VLINK=9966CC>
<center>
<table width=500 border=1>
<tr>
<td width=*>User Name</td><td width=70>User Info</a></td><td width=70>Admin</td><td width=70>Member</td>
<td width=70>Public</td><td width=70>Status</td></tr>
</table>
<table width=500 border=1>
<tr>
|;

&list;

print qq| </table>
</body>
</html>
|;

sub list
{
until ($user[$count]==0) {
print "Content-type: text/html\n\n";
print qq|
<td width=50>$user[$count]</td><td width=70><a href=user.pl?user=$user[$count]>info</a></td><td width=70>
<input type=radio value=3 name=3></td><td width=70><input type=radio value=2 name=2>
</td><td width=70><input type=radio value=1 name=1></td><td width=70>admin</td>
</tr>
|;

}
$count = "$count+1";
}

I don't get why it won't print the infomation from the sub, does any one have any ideas why?



Jasmine
Administrator / Moderator

Mar 31, 2001, 10:15 PM

Post #2 of 2 (208 views)
Re: not running sub. [In reply to] Can't Post

First, why does list have print "Content-type: text/html\n\n"; when the header has already been printed?

The counter is wrong, unless you really want $count to equal "0+1"


Code
$count = "$count+1";

should be


Code
$count++;

The until ($user[$count]==0) is never letting the count (when it gets fixed) to be incremented. Put the incrementer inside the until statement.

In the future, please enclose your code in

Code
 and

(remove the extra spaces). It's really hard following the code left-aligned.



 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives