in reply to A maybe(?) interesting comp-sci type problem
Warning: Code not tested.
# Call as: flatten([...]) sub flatten { my $aref=shift; die "not an array ref" unless ref($aref) eq 'ARRAY'; @result=(); foreach my $element (@$aref) { push @result, (ref($element) eq 'ARRAY' ? flatten($element) : $element); } @result; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A maybe(?) interesting comp-sci type problem
by tachyon-II (Chaplain) on May 06, 2008 at 11:04 UTC | |
|
Re^2: A maybe(?) interesting comp-sci type problem
by ikegami (Patriarch) on May 06, 2008 at 08:42 UTC |