in reply to Re^2: file comparison
in thread file comparison

Oh, in that case just compare the outputs with the cmp program if the outputs are written to files (eg. system("diff", "-s", "--", $filename1, $filename2) returns true if the files are different).

If you're sure you want the outputs in arrays, compare them with like join("", @output1) eq join("", @output2) if the lines in the arrays still have the trailing newlines or pack("(J/a)*", @output1) eq pack("(J/a)*", @output2) if you're not sure what the delimiters are or @output1 == @output2 and !grep { $output1[$_] ne $output2[$_] } 0 .. @output1 - 1 if you don't want to waste memory.

Replies are listed 'Best First'.
Re^4: file comparison
by fullermd (Vicar) on Aug 25, 2009 at 10:58 UTC

    Oh, in that case just compare the outputs with the cmp program if the outputs are written to files (eg. system("diff", "-s", "--", $filename1, $filename2) returns true if the files are different).

    Better, use File::Compare, which is part of the standard dist.