on Thu, 02 May 2002 18:29:08 GMT, Aman Raheja wrote:

> My code looks like following
> 
> foreach (@abc)
> {
>    $sth = $dbh->prepare("select distinct X from Y where P='$_'");
>    $sth->execute;
>    $reference = $sth->fetchall_arrayref();
> 
>    if(@$reference eq '')
>    {
>       print "$_ in empty";
>    }
> 
> }
> 

(untested)

    unless (@$reference) {
        print "$_ in empty";
    }
 
You also might want to move the prepare outside of the for-loop:

    $sth = $dbh->prepare("select distinct X from Y where P=?");
    foreach (@abc) {
        $sth->execute($_);
        # etc...
    }


-- 
felix

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

Reply via email to