in reply to array bug?

You don't specify what you think the bug is, but I'm going to assume you're surprised by the sort order. If so, you should reread the documentation on sort: unless you tell it otherwise, it sorts by string comparison, rather than numeric comparison. Since the character value for 3 is less than that of 8, "30" is less than "8" (but greater than "08", of course).

To get the result you're probably looking for, try

foreach (sort {$a <=> $b} @arr) {... }



If God had meant us to fly, he would *never* have given us the railroads.
    --Michael Flanders