in reply to going through an array

You need tell us what you are trying to do instead of just posting your code. If you can't explain what you are trying to do, then you shouldn't expect to be able to write successful code. You also need to show exactly what @value contains, and a few lines from the file you opened.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: going through an array
by Anonymous Monk on Nov 21, 2004 at 00:31 UTC
    so initially read the first colum from here into @value
    112 104.35 141.94 115 22.34 29.13 while (<IN>) { ($rub,$res) = split (/\s+/,$_); push @value, "$res\n"; }
    where this first column value agrees with the third colum in the next file, replace 100.0 with 3.0
    1 59 49 0.0 0 100.0 0.0 1 60 50 0.0 0 100.0 0.0 using code supplied in first post
      Your description of column counting seems to be a bit off.

      In your case, the SECOND column values (104.35, 22.34) get populated into @value. If you had wanted the first column, you would need to "push @value,$rub" . (And why are you adding the trailing "\n" ?)

      Also, in your original post, taking the index [3] from the result of the "split" gets you the FOURTH column (zero based).

      Most likely, a better understanding of perl's zero-based indexing would help fix this program.

          Earth first! (We'll rob the other planets later)

        And the trailing "\n" will cause your numeric comparison to never get a match.

      btw these are only segments from complete files