Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: erm... I need help!

by little (Curate)
on Apr 29, 2001 at 19:32 UTC ( [id://76477]=note: print w/replies, xml ) Need Help??


in reply to erm... I need help!

In an here document you don't need to escape quotes.
Inside your here document you missed the closing tag for the table.
If you want to print a string that contains double quotes you might use single quotes for that string eg:
print '<tr><td><a href="'.$rank{$_}{url}.'"><center><b>';
please correct your line as you omitted the ' for the hits:
for (sort {$rank{$b}{'hits'} <=> $rank{$a}{'hits'}} keys %rank)

Have a nice day
All decision is left to your taste
Update
as far as I came with it. Better try to use cgi.pm. It is easy and helps you a lot.
#!/usr/bin/perl -w use strict; my $memberListFile = "members.txt"; my $hits; my %rank; my $user; my $email; my $username; my $sitename; my $url; my $button; my $desc; print "Content-type:text/html\n\n"; open(USERS, $memberListFile) die ("can't open $memberListFile: $!"); while(<USERS>) { chomp; # ah, cleverly working on $_ ($user,$email) = split(/\|/); my $USR; # better find some naming conventions, for me looks this +like a CONSTANT in the source $user .= ".txt"; # still ugly, but better compose filenames before + using them (makes debugging easier) open (USR,"$user") or die ("can't open $user: $!"); $USR = <USR>; # scalar context ? why? do all these files only have + one line? close(USR); ($username, $sitename, $url, $email, $button, $desc, $hits) = spli +t(/\|/, $USR); $rank{$username} = { 'url' => $url, 'email' => $email, 'button' => $button, 'desc' => $desc, 'hits' => $hits, 'sitename' => $sitename, 'user' => $username }; } print <<eof; <font face="verdana" color="black"> <table WIDTH="75%" border="1" bordercolor="black" cellSpacing="0" cell +Padding="0" align="center"> <tr bgcolor="#000080"> <th> <font face="verdana" color="white"> Site </font> </th> <th> <font face="verdana" color="white"> button </font> </th> <th> <font face="verdana" color="white"> Hits </font> </th> </tr> eof foreach (sort {$rank{$b}{'hits'} <=> $rank{$a}{'hits'}} keys %rank) { # oh ouh here it is not clever to work with $_ print <<eof; <tr> <td align="center"> <b> <a href="$rank{$_}{url}"> $rank{$_}{sitename} </a> <br /> <font face="verdana" size="1"> $rank{$_}{desc} </font> </b> </td> <td align="center" width="88"> <img src="$rank{$_}{button}" height="31" width="88"> </td> <td align="center"> $rank{$_}{hits} </td> </tr> eof } print "</table>\n</font>";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://76477]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-29 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found