in reply to going loopy

The problem is how you create the @slopes and @steep_grads arrays, you're assigning to them, which is not what you want. Instead you want to be using the push function e.g
while (($key2, $value2) = each (%gradient_hash)) { if (($value2 > 0.1) || ($value2 < -0.1)) { push @steep_grads, $key2 . '?' . $value2; push @slopes, $value2; } }
This pushes the value onto the array, which looks to be desired behaviour. So hopefully now your code should do the right thing :)
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: going loopy
by Anonymous Monk on May 14, 2003 at 13:36 UTC
    Thanks for the advice, but I am still having a lot of trouble trying to split the @unique_slopes array! Any suggestions?
      Any suggestions?
      I don't mean to sound harsh but could you read How (Not) To Ask A Question and revise your post above? I can't really help you unless I understand what your problem is, a well stated question with context and relevant data goes a very long way to inspiring any would-be helpers.
      HTH

      _________
      broquaint

        Sorry broquaint I didn't mean to sound rude! ;-) This problem is with the split function which I often use (but it normally works).

        From my earlier post, I had an array named @unique_slopes which if printed to the screen looks like this;

        0.1375 0.102999999999999998 0.132500000000000002 0.264333333333333331 +0.636000000000000009 0.537499999999999989

        I wish to be able to access each element individually and thought that using 'join' followed by 'split' would allow me to do this;

        $unique_slopes = join ('', @unique_slopes); @unique_slopes = split (/\s+/, $unique_slopes);
        Split appears to be returning the original string as a single string accessible by $unique_slopes[[0]], which is not what I wanted.

        Do you know of an alternative way to split the array so that I can access individual elements? A whitespace character appears to be present between each number.

        Thanks for your time.