in reply to Re: Re: Array logic!
in thread Array logic!

Very well, but that means your solution is wrong, as the lowest value in the small array happens to be $small [0].

Eh, I can't read. In the example the lowest value isn't $small [0]. But what if it is?

Abigail

Replies are listed 'Best First'.
Re: Re: Array logic!
by BrowserUk (Patriarch) on Aug 06, 2003 at 12:46 UTC

    You made me look:) But isn't 77.0 < 78.6?


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
    If I understand your problem, I can solve it! Of course, the same can be said for you.

      Yes, I almost immediately updated my reply. But what if
      @small = qw /78.6 78.8 79.0 80.2 79.8/;

      But if we can assume $small [0] is correct, I suggest the following one-liner:

      @small = do {my $i; grep {$_ eq $small [0] .. ++ $i == @small} @nu +mbers};

      the other numbers in @small aren'r relevant then, only how many numbers there are.

      Abigail

        Nice golfing! ++

        ...the other numbers in @small aren'r relevant then, only how many numbers there are.

        That was the conclusion I came to on the strength of very little.

        I agree that the OP's description leaves a lot to be desired.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
        If I understand your problem, I can solve it! Of course, the same can be said for you.