in reply to Re: Why does every value of the array get replaced?
in thread Why does every value of the array get replaced?

array1 contains gene accession numbers of this format: X65a293846,X65a030294,X65a129385 array2 contains much more information that looks like this: 37483919..36271893 - 0 0 - X65a293846 - - DAR 42948502..38291239 - 0 0 - X65a030294 - - DAR Both arrays are read in from a file like this:

my $file = "gene.txt"; open(FH, "< $file") or die "Can't open $file for read"; while(<FH>){ push(@array1, $_); } close(FH);

The strange thing is that before this, I manually entered them into an array and it worked fine. Only now is it having problems.

Replies are listed 'Best First'.
Re^2: Why does every value of the array get replaced?
by toolic (Bishop) on May 27, 2015 at 18:47 UTC
      Hero
Re^3: Why does every value of the array get replaced?
by GotToBTru (Prior) on May 27, 2015 at 18:59 UTC

    Sorry, your description of the second array is unintelligible. Use <c> tags. Better still, I would suggest using the debugger to inspect the arrays immediately prior to your logic to make sure they contain what you expect. I suspect toolic's tip about chomp is also relevant.

    Dum Spiro Spero