At 12:20 AM 12/30/01 -0500, Gyepi SAM wrote:
>> my @qrefs;
>>   my $count = 0;
>>   for (my $x=0; $x<5; $x++)
>>     {
>>     my $ref = $qry->fetchrow_hashref();
>>     $qrefs[$count] = $ref;
>>     ++$count;
>>     }
>>   return(@qrefs);
>> } 
>
>Off topic, but that for loop could use some trimming
>#Watch out for those 'magic' numbers!
>for (my $x = 0; $x < 5; $x++){ 
>    $qrefs[$x] = $qry->fetchrow_hashref(); 
>}

I've been writing C so much today that Perl's starting to look like C!

How about:

  my @qrefs = map { $qry->fetchrow_hashref } 1..5;

Or you you live in the future:

  my @qrefs = map { { %{$qry->fetchrow_hashref} } } 1..5;


-- 
Bill Moseley
mailto:[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to