$values = an Array of Arrays
included an element I wanted to remove. Here's how I did it.The commented out line would be used if I wanted to simply empty the element that contained "UNKNOWN". The splice function proves it's usefulness here. I looked high and low for an example of splicing a multidimensional array and never found one. I hope this helps someone.for $d ($values) { for $x (0..100) { if (!defined(${$d}[$x]) ) { last;} #${$d}[$x] = "" if (${$d}[$x] eq "UNKNOWN"); splice (@$values, $x, 1) if (${$d}[$x] eq "UNKNOWN"); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multidimensional arrayrefs constructed from anonymous arrayrefs
by tilly (Archbishop) on May 06, 2004 at 21:44 UTC | |
|
Re: Multidimensional arrayrefs constructed from anonymous arrayrefs
by Roy Johnson (Monsignor) on May 06, 2004 at 19:11 UTC | |
|
Re: Multidimensional arrayrefs constructed from anonymous arrayrefs
by dragonchild (Archbishop) on May 06, 2004 at 18:06 UTC | |
|
Re: Multidimensional arrayrefs constructed from anonymous arrayrefs
by jryan (Vicar) on May 06, 2004 at 18:32 UTC |