in reply to push/append to hash in a loop
Consider using fetchrow_hashref instead of fetchrow_arrayref:
while ( my $row = $sth->fetchrown_hashref ){ $hasho{ $row{org_id} } = $row{org_nm}; }
If you really need to use fetchrow_array for some reason, you can just dump the results directly into variables:
while ( my ( $org_id, $org_nm ) = $sth->fetchrow_array()) { $hasho{$org_id} = $org_nm; }
Or, if you want to get real Perl-ish:
my %hash = map { $_->{org_id} => $_->{org_nm} } @{ $sth->fetchall_arra +yref };
Also, no need for the quoting of variables on the last line of your code.
split//,q{john hurl, pest caretaker}and(map{print @_[$_]}(join(q{},map +{sprintf(qq{%010u},$_)}(2**2*307*4993,5*101*641*5261,7*59*79*36997,13 +*17*71*45131,3**2*67*89*167*181))=~/\d{2}/g));
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: push/append to hash in a loop
by grinder (Bishop) on Mar 21, 2007 at 07:56 UTC |