in reply to Removing empty string elements from an Array
The above suggestion was great. Here's a more readable, and less efficient version:
This should push everything you want into @newArray. It's a bit slower than the grep solution, and has additional overhead of using another array; but I find it easier to read.my @newArray; foreach my $element ( @array ) { push $element, @newArray if $element; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Removing empty string elements from an Array
by chipmunk (Parson) on Feb 03, 2002 at 19:37 UTC | |
by traisjames (Initiate) on Apr 04, 2016 at 06:44 UTC | |
Re: Re: Removing empty string elements from an Array
by chip (Curate) on Nov 13, 2001 at 10:16 UTC | |
by Bobcat (Scribe) on Feb 03, 2002 at 18:28 UTC |
In Section
Seekers of Perl Wisdom