Subject: | Array-Diff bug |
Date: | Thu, 11 Sep 2008 13:44:55 -0400 |
To: | <bug-Array-Diff [...] rt.cpan.org> |
From: | "Steve Mckinney (stmckinn)" <stmckinn [...] cisco.com> |
The program at the bottom of the email shows a bug in Array-Diff. I
think it has to do with the ordering of the array items. It should
print:
old : 139 22
new : 22 137 139 3306
del :
add : 137 3306
Thank you,
Steve
#!/usr/bin/perl
use strict;
use Array::Diff;
my @old = (139,22);
my @new = (22,137,139,3306);
print "old : @old" . "\n" . "new : @new" . "\n\n";
my $diff = Array::Diff->diff(\@old, \@new);
my @del = map {$_} (@{$diff->deleted});
my @add = map {$_} (@{$diff->added});
print "del : @del" . "\n" . "add : @add" . "\n";