in reply to Merging Arrays into a Hash with Substitutions

Taking a trick from TheDamian you could also do this:
while ( my @row = $dbQuery->fetchrow_array() ) { $_ = "" for grep {not defined} @row; @info{@{$headings}} = @row; }
(I'd probably still reach for map first.)

Replies are listed 'Best First'.
Re: Re: Merging Arrays into a Hash with Substitutions
by Roy Johnson (Monsignor) on Apr 07, 2004 at 16:36 UTC
    Why have a grep and a for loop, though?
    # Grep in a void context! grep { defined or $_ = '' } @row; # or defined or $_ = '' for @row;