in reply to Array Reference Issue
- Millersub 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; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array Reference Issue
by mlong (Sexton) on Jul 15, 2007 at 04:07 UTC |