Thank you so much for your reply and precious time. I implemented your suggestion and here is the code:
#!/usr/bin/perl use strict; use warnings; # do first level statistical analysis run by run # go to the directory where the fsf-file for stats # and post-stats is stored chdir "/mnt/hgfs/ExpAutism/Scripts"; my $infile = 'Level1Run1_test.fsf'; my $outfile = 'Level1Run1_test_spec.fsf'; my $program = '/usr/local/fsl/bin/feat'; my @subjects = ("SubjectASD203","SubjectTD106C"); foreach my $subject (@subjects){ open my $fh_IN, '<', $infile or die "Could not open $infile ; $!"; open my $fh_OUT, '>', $outfile or die "Could not open $outfile ; $!"; # replace wildcards with specific titles of subjects while (<$fh_IN>){ s/Subjectx/$subject/g; print $fh_OUT $_; } close $fh_IN; close $fh_OUT; system($program,$outfile) == 0 or die "$program $outfile failed: $?"; } print "\n +++ DONE +++ \n";
The error message on the terminal: C/usr/local/fsl/bin/feat Level1Run1_test_spec.fsf failed: 2 at Level1Run1_test.pl line 28. The line 28 is system($program,$outfile) == 0
I am confused again. The problem seems to be with the feat file but what does "2" mean there? Do you have any suggestions?
PS1: The parent folder of each subject folder is /mnt/hgfs/ExpAutismand the parent folder of the fsf and pl files is /mnt/hgfs/ExpAutism/Scripts
Thanks in advance. Best,In reply to Re^2: Loop is not working
by ozdemmer
in thread Loop is not working
by ozdemmer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |