in reply to Re^2: script assistance please
in thread script assistance please
Made the following changes:
#!/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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: script assistance please
by perlnobie (Initiate) on Feb 19, 2015 at 22:16 UTC | |
by marinersk (Priest) on Feb 19, 2015 at 22:58 UTC |