in reply to Re: Why do i get an extra (duplicate) array element?-
in thread Why do i get an extra (duplicate) array element?-

From command-line argument. It's a fixed text file, in this case it only contains 4 lines but it can be thousands. The amount is always on that position on every line. The only way i could think of snatching them was through substr.

open IN, "<$ARGV[0]" or die "Could not open input file '$ARGV[0]' $!";

Flat text file would be many lines of equal length with the amounts at that same position in every line.

Replies are listed 'Best First'.
Re^3: Why do i get an extra (duplicate) array element?-
by Marshall (Canon) on Jun 23, 2016 at 23:17 UTC
    If you could show us an actual data line(s), then most likely other techniques than substr() could be used. Split with an array slice is often a good approach. Just post your 4 lines within <code>...</code> blocks and we can tell exactly what is going on.