On Nov 30, 12:21 am, [EMAIL PROTECTED] (John W . Krahn) wrote:
> On Thursday 29 November 2007 06:29, AY wrote:
>
>
>
> > I'm not sure what this piece of code does: Infact it is getting a
> > database query and iterating ...
>
> > my %temp;
>
> > while ( my %row = $dbproc->dbnextrow(1) ){
>
> $dbproc->dbnextrow(1) is returning a list and that list is assigned to
> the lexical hash %row which is only visible inside the while loop. If
> nothing is assigned to %row then %row will be false and the loop will
> end.
>
> > $temp{ $row{ i } } = { %row }; // No idea what this is doing.
>
> The value of $row{ i } is used as the key for the hash %temp and it is
> assigned a hash reference by copying the hash %row into an anonymous
> hash. Because the %row hash is local to the while loop you can skip
> the copying and just assign a hash reference:
>
> $temp{ $row{ i } } = \%row;
>
> > }
>
> John
> --
> use Perl;
> program
> fulfillment
Thanks John,
- ay
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/