Trying the code below only gives '%fdat undef', thus keys %fdat == 0. Weird
isn't it?!

****
use strict;
use DBIx::Recordset;
use vars qw(*set %fdat);
....
 *set = DBIx::Recordset->Search({%fdat,('!DataSource' => $db,
                                     '!Table'      => $table,
                                     '$fields'     => $joined_col,
                                     '$where'      => $query,
                                     '$max'        => 5)});
if (keys %fdat == 0) {
 print "<b>%fdat undef</b>",br;
} else {
 print "<b>%fdat def</b>",br;
 while (($a,$b) = each %fdat) {
     print "$a => $b";
 } }
*****
Marcus

> if(undef %fdat) {

> This will undef the content of %fdat so it will always be empty!!!
>
> To test if a variable is defined used defined($foo), but you can't ask  for
> a hash or a array if it's defined, you only could ask if it contains any
> keys, so you need to write:
>
> if (keys %fdat == 0) {
>
> >    print "<b>%fdat undef</b>",br;
> > } else {
> >    print "<b>%fdat def</b>",br;
> >    while (($a,$b) = each %fdat) {
> >        print "$a => $b";
> >    }}
>
> Does it print out %fdat now?
>
> Gerald
>
> -------------------------------------------------------------
> Gerald Richter    ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
>
> Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> E-Mail:     [EMAIL PROTECTED]         Voice:    +49 6133 925131
> WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> -------------------------------------------------------------

Reply via email to