in reply to Array Reference Issue

Yes, you are only splicing the sheep out of a copy of the array. To remove it from the original array, you must continue referring to it by reference.
sub RemoveSheep { my $self = shift; my $obj = shift; # This is the sheep object my $field = ${$self->{field}}; my $sheep_ref = $field->Sheep; for my $index (0..$#$sheep_ref) { my $sheep = $sheep_ref->[$index]; if ( $sheep == $obj ) { print "Before Splice: " . @$sheep_ref . "\n"; splice @$sheep_ref, $index, 1; print "After Splice: " . @$sheep_ref . "\n"; last; } } }
- Miller

Replies are listed 'Best First'.
Re^2: Array Reference Issue
by mlong (Sexton) on Jul 15, 2007 at 04:07 UTC
    Yep. That did it. Works perfectly. Thanks for your help. I figured it was something simple.