Subject: | Array::Uniq doesn't handle arrays containing entries with zero values |
The lines where $prev is checked should check to be sure that $prev is
defined instead:
*** Array/Uniq.pm~ Wed Aug 27 11:01:22 2003
--- Array/Uniq.pm Thu Apr 20 12:27:37 2006
***************
*** 16,22 ****
my $prev = undef;
my @out;
foreach my $val (@_){
! next if $prev && ($prev eq $val);
$prev = $val;
push(@out, $val);
}
--- 16,22 ----
my $prev = undef;
my @out;
foreach my $val (@_){
! next if defined($prev) && ($prev eq $val);
$prev = $val;
push(@out, $val);
}
***************
*** 29,35 ****
my $ins = undef;
my @out;
foreach my $val (@_){
! if ($prev && $prev eq $val){
next if ($ins && $ins eq $val);
push(@out, $val);
$ins = $val;
--- 29,35 ----
my $ins = undef;
my @out;
foreach my $val (@_){
! if (defined($prev) && $prev eq $val){
next if ($ins && $ins eq $val);
push(@out, $val);
$ins = $val;
***************
*** 47,53 ****
my $ctr = 0;
my @out;
foreach my $val (@_){
! if ($prev){
if ($prev eq $val){
$ctr ++;
next;
--- 47,53 ----
my $ctr = 0;
my @out;
foreach my $val (@_){
! if (defined($prev)){
if ($prev eq $val){
$ctr ++;
next;