Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

simonwilliams,

  1.    if ($#bids){...}
    does what you mean, but it doesn't really say what you mean. For that, you should say
       if (@bids > 1){ ... };
    i.e., if @bids contains more bids than one, then ...
  2.   for (my $i=1; $i<scalar(@bids); $i++) { ... }
    could be written ...
      for (my $i=1; $i < @bids; $i++) { ... }
    ... without any change in meaning. @bids is being evaluated in a scalar context. No need to say scalar() explicitly.
  3. 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.
    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"; }

mkmcconn

In reply to Re^3: everyauction script error bidding errors by mkmcconn
in thread everyauction script error bidding errors by simonwilliams

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-23 16:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found