in reply to Issue splitting in while Loop

The code you posted does not compile because it is missing semicolons at the end of a few lines. Here is code that compiles (and is perltidy):
open RAN, "f03_20859_04aug08RANmri_block2.log" or die "Unable to open file!"; open NEW, ">>Out.txt" or die "Unable to open file for output!"; open AVG, "Avg.txt" or die "Unable to open file for averaging!"; while ( my $text = <RAN> ) { if ( $text =~ /\bResponse\b/ ) { @response = split( /\s/, $text ); print NEW $text, "\n"; } print AVG $response[4]; } close NEW; close RAN; close AVG;
If you still have problems, you need to be specific: show us a few lines of the input file, your actual output and your expected output.

Replies are listed 'Best First'.
Re^2: Issue splitting in while Loop
by savem (Initiate) on Jul 29, 2011 at 21:02 UTC
    That was precisely the solution I was looking for. Thank you!