Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!

by graff (Chancellor)
on Sep 06, 2006 at 06:19 UTC ( #571379=note: print w/replies, xml ) Need Help??


in reply to Re: “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!
in thread “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!

Changed
my $nextidx = $asize / 2; my $nextinc = $nextidx / 2;
to:
my $nextidx = int($asize / 2); my $nextinc = int($nextidx / 2);
(Otherwise, for an array of 5 elements, it’d return an index = 2.5 ;-...)).

Actually, that change is unnecessary. Whenever a floating point value is used as an array index, Perl automatically uses just the integer part of the value, since that would be the only sensible thing to do.

  • Comment on Re^2: “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!
  • Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2023-01-29 09:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?