in reply to chomp any data structure recursively
sub mychomp { while (@_) { for (shift) { push @_, grep { ref || eval { defined && chomp; 0 }; } ref eq 'ARRAY' ? @$_ : ref eq 'HASH' ? values %$_ : ref eq 'SCALAR' ? $$_ : ref eq 'REF' ? $$$_ : $_ } } }
Of course even this is not complete as there could be a reference to a GLOB, which could contain a SCALAR, HASH and ARRAY. But who would use those :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: chomp any data structure recursively
by Juerd (Abbot) on Dec 21, 2001 at 19:44 UTC |