John W. Krahn wrote:
chen li wrote:
--- "John W. Krahn" <[EMAIL PROTECTED]> wrote:
chen li wrote:
Sorry to bother again. I get an AoA containing
empty
elements like these:
my @data=(
[1,1,1],
[2,2,2],
[],
[3,3,3],
[]
);
How can I remove the empty element in this AoA?
Can I
use grep function to do it?
Yes:
@data = grep @$_, @data;
Thank you very much for the help. But this line code
doesn't work for this format:
my @data=(
['1','1','1'],
['2','2','2'],
[''],
['3','3','3'],
['']
);
@data = grep @$_, map [ grep length, @$_ ], @data;
@data = grep { grep length, @$_ } @data;
does what is required.
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>