Dave, Thank you for your response. I'm new to perl. I guess I need more than a nudge in the right direction. I tried to reuse a code example for comparing files to no avail.
handleArgs(); if($outfile) { open (STDOUT, ">$outfile") || die "Cannot redirect STDOUT\n"; } open(TEMP,$newFile) || die "Error opening $newFile\n"; open(FILE,$oldFile) || die "Error opening $oldFile\n"; while(<TEMP>) { push(@temp, $_); } while(<FILE>) { push(@file, $_); } %temp = sort(@temp); %file = sort(@file); OUTER: foreach $_ ($file) { next if /^\s*$/; #ignore empty lines next if /^\s*#/; #ignore comments chomp; # $_ = lc; while(%temp) { $x = shift %temp; next if ($x =~ /^\s*$/); next if ($x =~ /^\s*#/); chomp $x; @compX = split /,/, $x; @compY = split /,/, $_; $comparison = lc($compY[0..2]) cmp lc($compX[0..2]); print "$_ - $x = $comparison\n" if $DEBUG; if($comparison == 0) { print "Record match...checking pctChange \n"; $fpPctChange = abs(($compX[3] - $compY[3]) / $compX[3] * 1 +00); if ($fpPctChange > 1) { print " BUT pct. Change greater than one.for $_ +. Please Investigate.\n"; print "Here's what was Found $_ AND $x\n"; } next OUTER; } else { print "this record is not a match. $_ , $x\n" if $DEBUG; next OUTER; } } print " This oldFile record was not found in newFile file! $_\n"; } if($W) { foreach $temp (@temp) { print "Warning $temp not expected\n";} } sub handleArgs() { while(@ARGV) { print "In Handle args\n" if $DEBUG; #Enable warnings if($ARGV[0] =~ /-W/i) { $W = 1; shift(@ARGV); } elsif($ARGV[0] =~ /-t/i) { $oldFile = $ARGV[1]; splice(@ARGV, 0, 2); } elsif($ARGV[0] =~ /-d/i) { $newFile = $ARGV[1]; splice(@ARGV, 0, 2); } elsif($ARGV[0] =~ /-O/i) { $outfile = $ARGV[1]; splice(@ARGV, 0, 2); } else { print "Invalid Arg in FileCmp ", shift (@ARGV),"\n"; } } }

In reply to Re^2: file merge by Anonymous Monk
in thread file merge by nraymond

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



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