note
mkmcconn
<p> [simonwilliams],
<ol>
<li /><code> if ($#bids){...}</code>
<br /><i>does</i> what you mean, but it doesn't really <i>say</i> what you mean. For that, you should say
<br /><code> if (@bids > 1){ ... } </code>;
<br />i.e., <i>if @bids contains more bids than one, then ... </i>
<li /><code> for (my $i=1; $i<scalar(@bids); $i++) { ... }</code>
<br />could be written ...
<br /><code> for (my $i=1; $i < @bids; $i++) { ... }</code>
<br /> ... without any change in meaning. @bids is being evaluated in a scalar context. No need to say [perlfunc:scalar|scalar()] explicitly.
<li /> Let me oversimplify your problem, and you can build on that. You want to choose the highest bid, excluding your own from consideration (always the first bid), and print only the highest bid.
<code>
my $highest;
if (@bids > 1){
for (my $i = 1; $i < @bids; $i++) {
my ($alias,
$email,
$bid,
$time,
$add1,
$add2,
$add3,
$oqty,
$soldqty) = read_bid($bids[$i]);
$highest = $bid > $highest ? $bid : $highest;
}
print "Highest bid: $highest\n";
}
</code>
</ol>
<br /> [mkmcconn]
468813
468843