I keep running into a issue while trying to run the below script. I'm pretty sure its just a formatting issue, but I can't for the life of me figure out what is wrong with the script. I am beginner at perl so any advice and help is welcome.
I am trying to open my file, pull out all lines containing a string, then parse the pulled out string via the split command. Here is the code, in a simplified form:
#!/usr/bin/perl # # # This script matches deliminating events in the RAN task, then pulls +out the Time of those # events. This script also pulls out the reaction time for each "respo +nse" event. 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
In reply to Issue splitting in while Loop by savem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |