vasavi has asked for the wisdom of the Perl Monks concerning the following question:
input_at.txt aaa,1 bbb,2 ccc,3 input_ac.txt 1,a 3,b 2,c#!usr/bin/perl use strict; use warnings; use diagnostics; open(FHAT, "input_at.txt") || die("Could not open file!"); open(OUTFH, ">outputfile.log") || die("Could not open file!"); while(<FHAT>){ chomp($_); print "$_\n"; print OUTFH "$_\n"; my ($at,$id1)=split(/\,/, $_); open(FHAC, "input_ac.txt") || die("Could not open file!"); while (<FHAC>){ print "ac $_"; my ($id2,$ac)=split(/\,/, $_); if($id2 == $id1){ print "SUCCESS $at : $ac : $id1"; print OUTFH "SUCCESS $at : $ac : $id1"; } } close (FHAC); } close (FHAT); close (OUTFH);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unable to write to file
by toolic (Bishop) on May 10, 2011 at 14:26 UTC | |
|
Re: Unable to write to file
by fidesachates (Monk) on May 10, 2011 at 15:32 UTC | |
|
Re: Unable to write to file
by papidave (Pilgrim) on May 10, 2011 at 22:52 UTC |