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.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;
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |