open(STDIN, "ICD_MEAS.txt") or die "Cannot open file"; @row = <STDIN>; $done = 0; $count = 0; while (@row[$done]) { chop(@row); foreach (@row[$count]) { @column = split(/\,/,@row[$count]); $last_name = @column[0]; $middle_name = @column[1]; $first_name = @column[2]; if ($source_type =~ /H/) { print ("$sat_name;"); print ("$meas_name;"); print ("$first_name;"); } if ($source_type =~ /C/) { open(STDIN1, "ICD_MEAS_child.txt") or die "Cannot open file"; @row = <STDIN1>; $done = 0; $count = 0; while (@row[$done]) { chop(@row); foreach (@row[$count]) { @column = split(/\,/,@row[$count]); $status = @column[0]; $age = @column[1]; $address = @column[4]; print ("$sat_name;"); print ("$meas_name;"); print ("$first_name;"); print ("$status;"); print ("$age;"); print ("$address;"); } } }close STDIN1; count++; } done++ }close stdin;
I don't know what I'm doing wrong b/c the first line is the H so it prints the first line stuff, the second line is a C so it prints the new file stuff and the first file, but wont go back to the first file to get the next line of data so I could see if it's a H or C. It doesn't loop back.

2003-05-28 edit ybiC <code> tags


In reply to Re: Re: Re: Re: Multiple text files by Anonymous Monk
in thread Multiple text files by Anonymous Monk

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.