Made the following changes:

  1. Checked status of open statements and displayed errors where appropriate;
  2. Displayed suggested debugging statements.
    • NOTE: These might mess with your use of $_ and @_. I haven't used those in so long I've forgotten the rules.
  3. #!/usr/bin/perl use strict; my %csga = (); my $moyr="12/2014"; $,="\t"; if (!open(IN,"<COS_SGA_xref.txt")) { print "ERROR: Cannot open input file COS_SGA_xref.txt\n"; } else { while(<IN>) { # Using chop instead of chomp here makes me nervous - marine +rsk chop; @_ = split(/\t/); $csga{$_[0]}=$_[1]; } close IN; if (!open(IN,"<cc.txt")) { print "ERROR: Cannot open input file cc.txt\n"; } else { if (!open(OUT,">new_cc.txt")) { print "ERROR: Cannot open output file new_cc.txt\n"; } else { for(my $i=0;$i<9;$i++) {$_=<IN>;} my ($mo,$yr)=@_ = split(/\//,$moyr); while(<IN>) { # Use of chop instead of chomp here makes me nervo +us - marinersk chop; @_ = split(/\t/); my $created=pop(@_); my ($mocr,$day,$yrcr)=@_ = split(/\//,$created); print "DEBUG: -----------------------------\n"; print "DEBUG: \$yrcr.\$mocr = [$yrcr.$mocr]\n"; print "DEBUG: \$yr.\$mo = [$yr.$mo]\n"; if($yrcr.$mocr >= $yr.$mo) { my $cc=$_[1]; $cc =~ y/C_//d; splice(@_,3,1); shift(@_); print OUT $created,@_,$csga{$cc}; print OUT "\n"; } } # Cleanup close OUT; } # Cleanup close IN; } } __END__

    And the results:

    D:\PerlMonks>test3.pl ERROR: Cannot open input file COS_SGA_xref.txt D:\PerlMonks>

    Any further debugging requires information from you.

    Good luck!


    In reply to Re^3: script assistance please by marinersk
    in thread script assistance please by perlnobie

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



  4. Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  5. Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  6. Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  7. Please read these before you post! —
  8. 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
  9. 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;
  10. Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  11. See Writeup Formatting Tips and other pages linked from there for more info.