Thanks to everyone for commenting on my question. I just added the following line  use diagnostics; and reran the code. The loop worked successfully, and the result seems to be okay too. However, I received this long and confusing message in the terminal. What does this message mean exactly?

sluser@localhost Scripts]$ perl Level1Run1_test.pl 1538605204768 addons.update-checker WARN onUpdateCheckComplet +e failed to parse update manifest: [Exception... "Update manifest is +missing a required addons property." nsresult: "0x80004005 (NS_ERROR +_FAILURE)" location: "JS frame :: resource://gre/modules/addons/Addo +nUpdateChecker.jsm :: getRequiredProperty :: line 473" data: no] Sta +ck trace: getRequiredProperty()@resource://gre/modules/addons/AddonUp +dateChecker.jsm:473 < parseJSONManifest()@resource://gre/modules/addo +ns/AddonUpdateChecker.jsm:483 < UpdateParser.prototype.onLoad/parser( +)@resource://gre/modules/addons/AddonUpdateChecker.jsm:655 < UpdatePa +rser.prototype.onLoad()@resource://gre/modules/addons/AddonUpdateChec +ker.jsm:675 < UpdateParser/<()@resource://gre/modules/addons/AddonUpd +ateChecker.jsm:593 1538605204784 addons.update-checker WARN onUpdateCheckComplet +e failed to parse update manifest: [Exception... "Update manifest is +missing a required addons property." nsresult: "0x80004005 (NS_ERROR +_FAILURE)" location: "JS frame :: resource://gre/modules/addons/Addo +nUpdateChecker.jsm :: getRequiredProperty :: line 473" data: no] Sta +ck trace: getRequiredProperty()@resource://gre/modules/addons/AddonUp +dateChecker.jsm:473 < parseJSONManifest()@resource://gre/modules/addo +ns/AddonUpdateChecker.jsm:483 < UpdateParser.prototype.onLoad/parser( +)@resource://gre/modules/addons/AddonUpdateChecker.jsm:655 < UpdatePa +rser.prototype.onLoad()@resource://gre/modules/addons/AddonUpdateChec +ker.jsm:675 < UpdateParser/<()@resource://gre/modules/addons/AddonUpd +ateChecker.jsm:593 1538605204810 addons.update-checker WARN onUpdateCheckComplet +e failed to parse update manifest: [Exception... "Update manifest is +missing a required addons property." nsresult: "0x80004005 (NS_ERROR +_FAILURE)" location: "JS frame :: resource://gre/modules/addons/Addo +nUpdateChecker.jsm :: getRequiredProperty :: line 473" data: no] Stack trace: getRequiredProperty()@resource://gre/modules/a +ddons/AddonUpdateChecker.jsm:473 < parseJSONManifest()@resource://gre +/modules/addons/AddonUpdateChecker.jsm:483 < UpdateParser.prototype.o +nLoad/parser()@resource://gre/modules/addons/AddonUpdateChecker.jsm:6 +55 < UpdateParser.prototype.onLoad()@resource://gre/modules/addons/Ad +donUpdateChecker.jsm:675 < UpdateParser/<()@resource://gre/modules/ad +dons/AddonUpdateChecker.jsm:593 1538605204818 addons.update-checker WARN onUpdateCheckComplet +e failed to parse update manifest: [Exception... "Update manifest is +missing a required addons property." nsresult: "0x80004005 (NS_ERROR +_FAILURE)" location: "JS frame :: resource://gre/modules/addons/Addo +nUpdateChecker.jsm :: getRequiredProperty :: line 473" data: no] Sta +ck trace: getRequiredProperty()@resource://gre/modules/addons/AddonUp +dateChecker.jsm:473 < parseJSONManifest()@resource://gre/modules/addo +ns/AddonUpdateChecker.jsm:483 < UpdateParser.prototype.onLoad/parser( +)@resource://gre/modules/addons/AddonUpdateChecker.jsm:655 < UpdatePa +rser.prototype.onLoad()@resource://gre/modules/addons/AddonUpdateChec +ker.jsm:675 < UpdateParser/<()@resource://gre/modules/addons/AddonUpd +ateChecker.jsm:593 1538605204826 addons.update-checker WARN onUpdateCheckComplet +e failed to parse update manifest: [Exception... "Update manifest is +missing a required addons property." nsresult: "0x80004005 (NS_ERROR +_FAILURE)" location: "JS frame :: resource://gre/modules/addons/Addo +nUpdateChecker.jsm :: getRequiredProperty :: line 473" data: no] Sta +ck trace: getRequiredProperty()@resource://gre/modules/addons/AddonUp +dateChecker.jsm:473 < parseJSONManifest()@resource://gre/modules/addo +ns/AddonUpdateChecker.jsm:483 < UpdateParser.prototype.onLoad/parser( +)@resource://gre/modules/addons/AddonUpdateChecker.jsm:655 < UpdatePa +rser.prototype.onLoad()@resource://gre/modules/addons/AddonUpdateChec +ker.jsm:675 < UpdateParser/<()@resource://gre/modules/addons/AddonUpd +ateChecker.jsm:593 + DONE +++

Just in case you need to see the code I used again:

#!/usr/bin/perl use strict; use warnings; use diagnostics; # do second 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";

Thanks a ton!


In reply to Re^2: Loop is not working by ozdemmer
in thread Loop is not working by ozdemmer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.