This:
open( POCUS, "/home/BioGeek/results_100.out" ||die $!\n";
has several syntax errors so it can't come from any working code.

Anyway, it looks to me (if this resembles the actual code, and assuming the warning is from the $results[$i]->[0] eq $disease_name_pocus[0] line) that reading the input file is ok, so probably $disease_name_pocus[0] is undefined. It gets set from @_ which is generally used for passing subroutine arguments. Maybe this is part of a sub and you're calling it incorrectly?

ofcourse, this code will also warn if you have blank lines or other lines in your input that don't conform to the sample input you gave above.

Also,

$results[$i]->[1] ne $results[ ( $i + 1 ) ]->[1]

will test one element past the current length of @results at the last iteration, and will also give the warning.

I'd probably write it something like this:

my $disease_name_pocus = 'something'; # dont' need array, we only ever use the first value anyway open POCUS,"<","/home/BioGeek/results_100.out" or die "can't open /home/BioGeek/results_100.out: $!\n"; open MARKER, ">","marker_list.txt" or die "Can't open marker_list.txt: $!"; my $lastline; while (<POCUS>) { chomp; # remove newline next unless /\S/; # only use lines that contain something else + than spaces my @result = [split]; next unless $result[0] eq $disease_name_pocus; next if (defined $lastline and $lastline eq $result[1]); $lastline = $result[1]; print MARKER "$result[1]\t$result[4]\n"; } close POCUS; close MARKER;

In reply to Re^3: use of uninitialized value in string ne by Joost
in thread use of uninitialized value in string ne by BioGeek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.