sub RemoveSheep { my $self = shift; my $obj = shift; # This is the sheep object my $field = ${$self->{field}}; my @sheep = @{$field->Sheep}; my $index = 0; my $found = undef; foreach my $sheep (@sheep) { if( $sheep == $obj ) { $found = $index; last; } $index++; } if( defined($found) ) { my $sheep = $sheep[$found]; print "Before Splice: " . @sheep . "\n"; splice (@sheep, $found, 1); print "After Splice: " . @sheep . "\n"; } }