Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Merging Arrays into a Hash with Substitutions

by tilly (Archbishop)
on Apr 07, 2004 at 16:22 UTC ( [id://343327]=note: print w/replies, xml ) Need Help??


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;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://343327]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-03-29 15:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found