HI all, I.m very new to Perl, but I've been told it's such a powerful language for text processing I wanted to try it and learn. So, I'm writing my first script which I need to process some text file. Basically that's what I want to do: I have 3 files, I want to read some informations from the first 2, and then write on the third. In depth, I want to read every line from the first and retrieve that line (or part of it) in a line of the second. Now, in the second file, I want to read all the lines subsequent to the line retrieved untile a termination charachter is found (in my case, when a line equal to the dot (".") is met) and print some infos in third. I want to repeat the operation until all the lines from the first line are ended. That's what I wrote, but it doesn't work, in particular the variable $count is always equal to 1. THat means it's not reading oll the lines from the first file.
!/usr/local/bin/perl -w open(FILEWRITE, ">write_seg06091999.txt")|| die "Could not open $write_seg06091999.txt\n"; #open(FILESEG, "seg06091999.txt")|| die "Could not open $seg06091999.txt\n"; #open(FILEALIGN, "walign06091999.txt")|| die "Could not open $walign06091999.txt\n"; open(FILESEG, "seg_short.txt")|| die "Could not open seg_short.txt\n"; open(FILEALIGN, "align_short.txt")|| die "Could not open align- short.txt\n"; $count = 1; my $line_align = " "; ## read every line of a file while ($line_seg = <FILESEG>) { while($line_align = <FILEALIGN>){ if($line_align =~ /19990609_1900_1920_inter_fm_dga.$count/){ do{ if($line_align ne "."){ $line_align = <FILEALIGN>; print FILEWRITE $line_align, "$count\n"; } }until $line_align eq "."; last; } } $count = $count+1; } you have some ideas why it's not working? probably ny programming style and my explantion sucks, so feel free to ask for more clear explanations... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/