Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
sub poll_view { $sth = $dbh->prepare("SELECT * FROM poll WHERE status = 'active'"); $sth->execute or die $dbh->errstr; @slog = $sth->fetchrow_array; print qq~ <table align="center" width="100%" cellpadding="4" cellspacing="0"> <tr> <td class="darktext"> <font size="2"><b>$slog[1]</b></font> <table width="100%" cellpadding="2" cellspacing="2"> ~; poll_do_it("darktext"); print qq~ </table> </td> </tr> </table> ~; } sub poll_do_it { ($ab) = @_; for($i=2; $i <= 6; $i++) { if($slog[$i]) { $a = $i + 5; print "<tr><td width=\"190\" class=\"$ab\">$slog[$i]</td> <td width=\"10\" class=\"$ab\"> $slog[$a]</td>"; if($slog[$a] eq "0") { $fin = "0.00%"; $num = 0; } else { $fin = sprintf("%.2f%", ($slog[$a]/$slog[12])*100); $num = sprintf("%.0f", ($slog[$a]/$slog[12])*150); } print "<td width=\"160\"> <img src=\"images/left.gif\" width=\"2\" height=\"5\"><img +src=\"images/poll.gif\" width=\"$num\" height=\"5\"><img src=\"images +/right.gif\" width=\"2\" height=\"5\"></td> <td width=\"10\" class=\"$ab\">$fin</td></tr>"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: including subroutines
by grinder (Bishop) on Jul 21, 2002 at 23:36 UTC | |
|
Re: including subroutines
by valdez (Monsignor) on Jul 22, 2002 at 14:04 UTC |