Skip to main content.
home | support | download

Back to List Archive

Re: dynamically generating @servers for spider.pl

From: Bill Conlon <bill(at)not-real.tothept.com>
Date: Wed Nov 24 2004 - 20:06:41 GMT
Thanks, the hash reference gets pushed onto the list, and now exposes 
more of my ignorance.

Say I have three rows returned by my SQL query.  The while loop 
properly generates three hashes, and @servers grows to contain three 
elements, but each has the same hash reference, which ends up pointing 
to the last created hash.  How do I programatically generate a series 
of hash references?

tia.

On Monday, November 22, 2004, at 06:34  PM, Bill Moseley wrote:

> On Mon, Nov 22, 2004 at 04:41:11PM -0800, Bill Conlon wrote:
>> I'm trying it along these lines:
>>
>> while (@ary = $sth->fetchrow_array ())
>> {
>> %hash = (
>>      base_url    =>  $ary[1],
>> 	max_depth => $ary[2],
>>      );
>>      push @servers, %hash;
>
>     push @servers, \%hash;
>
> You want to push a hash reference on the list.
>
>
>
> -- 
> Bill Moseley
> moseley@hank.org
>
> Unsubscribe from or help with the swish-e list:
>    http://swish-e.org/Discussion/
>
> Help with Swish-e:
>    http://swish-e.org/current/docs
>    swish-e@sunsite.berkeley.edu
>
Received on Wed Nov 24 12:06:43 2004