my @ar = grep length, flatten(@array); print Dumper(@ar); sub flatten{ return unless @_; my ($car,@cdr) = @_; if(ref($car) eq 'ARRAY'){ flatten(@$car, @cdr); } else { $car, flatten(@cdr); } }
In reply to Re: How to flatten an x-dimensional array?
by abstracts
in thread How to flatten an x-dimensional array?
by Incognito
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |