25, 2002 2:33 PM
Subject: Re: Problem with foreach
> >
> > If i try this...
> >
> > [$ foreach $row @$result $]
> > [+ $row +]
> > [$ endforech $]
> >
> > ... the only output is a '0', there should be an ARRAY ref there.
> >
>
>
>
> If i try this...
>
> [$ foreach $row @$result $]
> [+ $row +]
> [$ endforech $]
>
> ... the only output is a '0', there should be an ARRAY ref there.
>
I should have seen this after your first mail...
$row is special inside a Embperl page. It's always the row counter and
because you are no
om: "Gavin Carr" <[EMAIL PROTECTED]>
To: "Christian Frantsen" <[EMAIL PROTECTED]>
Sent: Sunday, February 24, 2002 9:33 PM
Subject: Re: Problem with foreach
> On Sun, Feb 24, 2002 at 07:14:23PM +0100, Christian Frantsen wrote:
> > Could someone explai
>
> @$result is the result of a database query using DBI with
> selectall_arraryref()
>
Normaly both should work. Which version of Embperl do you using? Does it
change anything if you make ( ) around the @$result in the second example?
Gerald
---
Could someone explain to me why this works...
[-
foreach $row (@$result) {
print OUT "$row->[1]";
}
-]
.. and this doesn't?
[$ foreach $row @$result $]
[+ $row->[1] +]
[$ endsub $]
@$result is the result of a database query using DBI with
selectall_arraryref()
/Christian
-