in reply to Re: script assistance please
in thread script assistance please
Made the following changes:
#!/usr/bin/perl use strict; my %csga = (); my $moyr="12/2014"; $,="\t"; open(IN,"<COS_SGA_xref.txt"); while(<IN>) { chop; @_ = split(/\t/); $csga{$_[0]}=$_[1]; } close IN; open(IN,"<cc.txt"); open(OUT,">new_cc.txt"); for(my $i=0;$i<9;$i++) {$_=<IN>;} my ($mo,$yr)=@_ = split(/\//,$moyr); while(<IN>) { chop; @_ = split(/\t/); my $created=pop(@_); my ($mocr,$day,$yrcr)=@_ = split(/\//,$created); if($yrcr.$mocr >= $yr.$mo) { my $cc=$_[1]; $cc =~ y/C_//d; splice(@_,3,1); shift(@_); print OUT $created,@_,$csga{$cc}; print OUT "\n"; } } close IN; close OUT; __END__
And the results:
D:\PerlMonks>test2.pl D:\PerlMonks>
It created an empty output file called new_cc.txt. I presume that's because I did not have the input file COS_SGA_xref.txt.
I'm afraid additional debugging will be all guesswork unless you can provide sample input data.
At a guess, however, your problem is one of two things:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: script assistance please
by marinersk (Priest) on Feb 19, 2015 at 22:09 UTC | |
by perlnobie (Initiate) on Feb 19, 2015 at 22:16 UTC | |
by marinersk (Priest) on Feb 19, 2015 at 22:58 UTC | |
|
Re^3: script assistance please
by perlnobie (Initiate) on Feb 19, 2015 at 22:12 UTC |