perlcoder has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: erm... I need help!
by little (Curate) on Apr 29, 2001 at 19:32 UTC
    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>";
(jptxs) Re: erm... I need help!
by jptxs (Curate) on Apr 29, 2001 at 23:49 UTC
    please see little's post for a solution, I just have a request that may help you. When posting a question, please be sure that you have a descriptive title for it. The selfish reason for this request is that it makes sure that if someone has a similar problem in the future (read: if I have this problem) and a search is done, this thread will come up and maybe have the answer. The not so selfish reason for this request is that by formulating a title that is to the point you assure that you yourself have a consice understanding of the problem as well. Let's face it, if you can't ask a good question what's the odds you'll either get a good answer or understand the answer if you happen to...
    "A man's maturity -- consists in having found again the seriousness one had as a child, at play." --Nietzsche
Re: erm... I need help!
by olly (Scribe) on Apr 29, 2001 at 19:05 UTC
    I don't get what you are asking. Do you get an error message when running the code? If so it may be wise to include it. Did you try running with the -d and -w flags? And use some dies in the code for example

    open(USER, "user.txt") || die "error opening:  $!";

    Imagination is more important then knowledge -Einstein-

Re: erm... I need help!
by bjelli (Pilgrim) on Apr 29, 2001 at 20:21 UTC
      So tell us, what does it do??
      anything? :-)

      Have a nice day
      All decision is left to your taste