in reply to Comparing Elements of Two Arrays
#!/usr/bin/perl -w use strict; use Algorithm::Diff; die "usage: $0 path1 path2\n" unless $#ARGV == 1; my @path1 = split('/', $ARGV[0]); my @path2 = split('/', $ARGV[1]); sub match { print "same:\t$path1[$_[0]]\t$path2[$_[1]]\n"; } sub discA { print "omitA:\t$path1[$_[0]]\n"; } sub discB { print "omitB:\t\t$path2[$_[1]]\n"; } Algorithm::Diff::traverse_sequences( \@path1, \@path2, { MATCH => \&match, DISCARD_A => \&discA, DISCARD_B => \&discB });
|
|---|