Hi, I am reading in a tab seperated file, taking the first field (a string of digits), and I am then splitting that string into an array, so I can address each digit seperately. The wierd thing is, although the digits are all showing up fine when I print the entire line from the file, some of the arrays are missing data, so that when I go through the array matching the constants to other variables, suddenly the entry I am looking at contains absolutely nothing. I cannot figure this out. It is not happenning all the time and I do not touch the array between the split and the debug example. Does anyone have any ideas?
while(<FILE>){ my @line = split (/\t/, $_); my @fileid = split(//, $line[0]); .... print "$_"; ##Shows e.g. 1159485660 cindy foreach my $fid(@fileid){ print "$fid "; ##Shows e.g. 1 1 9 4 8 5 6 0 } }

In reply to Splitting a string is giving me gaps in my array by jenand

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.