Re: map array to hash
- From: paul@xxxxxxxx (Paul Johnson)
- Date: Mon, 29 May 2006 15:34:48 +0200
On Mon, May 29, 2006 at 09:16:00AM -0400, John Ackley wrote:
there is more than one way to do it
is there an easier way to do this map:
my $index = 0;
while( my @a = $SQL->fetchrow_array) {
my %a = map { $fieldnames[$index++] => $_ } @a;
my %a;
@a{@fieldnames} = @a;
print "$_ => $a{$_}\n" for (keys %a);
}
--
Paul Johnson - paul@xxxxxxxx
http://www.pjcj.net
.
- References:
- map array to hash
- From: John Ackley
- map array to hash
- Prev by Date: map array to hash
- Next by Date: Capture Win32 events
- Previous by thread: map array to hash
- Next by thread: Re: map array to hash
- Index(es):