On Friday, April 19, 2002, at 02:17 , Bob Showalter wrote: [..] >> On Friday, April 19, 2002, at 12:29 , Pedro A Reche Gallardo wrote: >> >>> I am trying to print only the line that contain the ">" symbol and the >>> next line.
Bob, I will defer to Pedro on this - my reading had been that given >line1 line2 line3 he only wanted the line1 - with the prefix symbol - and the next line hence 'line2' - but we would not need to pick out any other lines until we got to the next line with a 'prefix' in it... > drieux, your solution has contains the code (pasted from your web page): > > ### while(<FH>) { > ### if( /^$prefix/ ) { > ### print "$_"; > ### my $nextLine = <FH>; > ### print "$nextLine"; > ### } > ### } # end while > > Consider the following input data: > >> Line 1 >> Line 2 > This is line 3. Should it print? > > Your code will not print line 3. Since it is the line following a line > containing a ">", it seems that it should be printed, no? if by this you wanted say line1 >line2 line3 line4 { edit the qw/... in the code to scramble up the 'input' any way you want.... } then the output would be >line2 line3 hence we could change it to have Foist we Make the File with: bob >line1 fred line2 line3 >line4 alice line5 line6 >line7 >line8 wombat Fremonge Now we Do The VooDoo >line1 fred >line4 alice >line7 >line8 The 'logic fault' is that I am not imposing upon '>line8' that I pick up the line after it - since It was picked up as the 'second line' after the match at '>line7' - but that is either a) a data integrity problem - that the data set, as showed, does not comply with the premise - and should be fixed. b) a product enhancement, which, with enough user requests can be scheduled for the next release.... 8-) c) case not covered in the market requirements docuement... please resubmit your concern to the Project Management Team for subsequent confusion of specifications and delivery dates. does that help? ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]