Good Morning Monks!
My question is as follow: I am updating lines across many files at once and the following code does just that with two(2) files. However once I add a third(3rd) file it does NOT update. Although the time stamp in the files directory says it was...the data in the file stays the same. The other two(2) files DO get updated. Thanks for the help!

sub update_lcrecord_now { my ($lcid,$lcroadname,$lcroadnumber,$locotype,$lcowner,$lcinterrr,$lca +ssign) = @_; open my $lcinfile, '<',"$rrconfig::locodata" or die $!; open my $lcinfile2, '<',"$rrconfig::availlocodata" or die $!; open my $lcinfile3, '<',"$rrconfig::availlocoyng" or die $!; open my $lcoutfile, '>', "$rrconfig::locotemp" or die $!; open my $lcoutfile2, '>', "$rrconfig::availlocotemp" or die $!; open my $lcoutfile3, '>', "$rrconfig::availynglocotemp" or die $!; while (<$lcinfile>) { s/^$lcid\:.*/$lcid\:$lcroadname\:$lcroadnumber\:$locotype\:$lcowner\:$ +lcinterrr\:$lcassign/g; print $lcoutfile $_; } while (<$lcinfile2>) { s/^$lcid\:.*/$lcid\:$lcroadname\:$lcroadnumber\:$locotype\:$lcowner\:$ +lcinterrr\:$lcassign/g; print $lcoutfile2 $_; } # DOESN'T WORK while (<$lcinfile3>) { s/^$lcid\:.*/$lcid\:$lcroadname\:$lcroadnumber\:$locotype\:$lcowner\:$ +lcinterrr\:$lcassign/g; print $lcoutfile3 $_; } close $lcinfile; close $lcinfile2; close $lcinfile3; # DOESN'TT WORK close $lcoutfile; close $lcoutfile2; close $lcoutfile3; # DOESN'T WORK move "$rrconfig::locotemp", "$rrconfig::locodata" or die "move failed: + $!"; move "$rrconfig::availlocotemp", "$rrconfig::availlocodata" or die "mo +ve failed: $!"; move "$rrconfig::availynglocotemp", "$rrconfig::availlocoyng" or die " +move failed: $!"; # DOESN'T WORK }


In reply to Update Multiple Files by PilotinControl

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.