> -----Original Message-----
> From: Zachary Buckholz [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 12:26 PM
> To: Timothy Johnson; [EMAIL PROTECTED]
> Cc: Shawn; Connie Chan; [EMAIL PROTECTED]
> Subject: more example code Re: help dereferencing arrayref so 
> I can put
> the value into a hash
> 
> ...
> 
> my $url_id_list = get_url_id_list();
> foreach my $url_id(@$url_id_list) {
>   $url_id = @$url_id[0];

That should be $url_id = $url_id->[0];

Since the query in get_url_id_list() returns a single column,
consider using the selectcol_arrayref() method, which elimiates
a level of nesting, and would let you elimiate this statement.

>   my $config_details = get_config_details($url_id);
>   my $chk_freq = @$config_details[0]->[0];

That should be $chk_freq = $config_details->[0][0], and so forth.

You can assign everything at once:

    my ($chk_freq, $url_timeout, $url, ...blah...) =
@{$config_details->[0]};

It appears get_config_details will be returning only a single
row. If so, consider using the selectrow_arrayref() method, which
removes a nesting level, so you could say:

    my ($chk_freq, $url_timeout, $url, ...blah...) = @$config_details};

[snip rest for brevity]

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

Reply via email to