boddeti has asked for the wisdom of the Perl Monks concerning the following question:
I have written with my initial knowledge, couldnt find where iam going wrong.
can any guide me, where i am going wrong or is there any other way of doingfor my $arg (@ARGV) { #$script=$ARGV[0]; #$stanza=$ARGV[1]; $metricsfile=$ARGV[0]; $resultfile=$ARGV[1]; } print "MetricsFilename:$metricsfile\n"; ### Assigning the argument file to in_file #### $in_file = $metricsfile; ### Opening the input file to read #### open (IN, "<$in_file") or die "Can't open $in_file: $!"; ### A while condition to read all the lines in a file and place in an +array#### #my $linenum=1; while(@linesFromMetrics=<IN>){ # opening while loop #print "Reading metrics file \n"; #print $linenum++; # closing while loop foreach $Metricsline(@linesFromMetrics){ ####------------------------------------------##### ### READING THE RESULTS CSV FILE ##### ####----------------------------------------#### print "ResultFilename:$resultfile\n"; ### Assigning the argument file to in_file #### $input_file = $resultfile; ### Opening the input file to read #### open (INPUT, "<$input_file") or die "Can't open $input_file: $!"; ### A while condition to read all the lines in a file and place in an + array#### while(@linesFromresultfile=<INPUT>){ # opening while loop my $var=false; foreach $Resultline(@linesFromresultfile){ if($Metricsline eq $Resultline){ print "The lines from metrics file :$Metricsline \n"; print "The lines from results file :$Resultline \n"; print "The line matches \n"; $var=true; } } # result file for each loop if($var=false) { print "mismatch"; } } # while results file close INPUT; } # metrics file for each loop } # while metrics file close IN;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: compare records in two csv files
by blazar (Canon) on Jan 19, 2006 at 13:37 UTC | |
|
Re: compare records in two csv files
by svenXY (Deacon) on Jan 19, 2006 at 13:44 UTC | |
|
Re: compare records in two csv files
by Limbic~Region (Chancellor) on Jan 19, 2006 at 14:03 UTC | |
|
Re: compare records in two csv files
by radiantmatrix (Parson) on Jan 19, 2006 at 16:04 UTC |