Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

RE: A minor epiphany with grep and map

by mwp (Hermit)
on Jul 25, 2000 at 08:11 UTC ( #24245=note: print w/replies, xml ) Need Help??


in reply to A minor epiphany with grep and map

This is handy too. I've often felt that DBI lacks a fetchall_hashref method. :)

my $sth = $dbh->prepare(q{ SELECT Table_PK, Name ... }); $sth->execute; my %lookup = map { $_->[0], $_->[1] } @{ $sth->fetchall_arrayref };

Here's one of my favorites:

$sth->bind_columns( map { undef ${$_}; \${$_}; } @{ $sth->{NAME_lc} } ); while($sth->fetch) { print("$table_pk\t$name\n"); }

It's good to be lazy.

Alakaboo
I am the lurker that spams in the night.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2020-12-05 18:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (65 votes). Check out past polls.

    Notices?