Thanks Bob - I tried switching to selectcol instead of selectall and
returning that and changed the foreach as you said below but I get
"Can't use string ("21185") as an ARRAY ref while "strict refs" in use at
./weeklyreport.pl line 14."

So I must be trying to dereference an already dereferenced arrayref?

zack


"Bob Showalter" <[EMAIL PROTECTED]> wrote in message
2E4528861499D41199D200A0C9B15BC031BBA6@FRISTX">news:2E4528861499D41199D200A0C9B15BC031BBA6@FRISTX...
> > -----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