in reply to Re^2: going through an array
in thread going through an array

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)

Replies are listed 'Best First'.
Re^4: going through an array
by steves (Curate) on Nov 21, 2004 at 03:10 UTC

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

      It shouldn't matter. Can you post a test case that demonstrates that it does?

      #! perl use strict; use warnings; use Test::More tests => 1; my $x = 100; my $y = 100 . "\n"; cmp_ok( $x, '==', $y, 'numeric comparison should numify SVs' );