Useless use of a (constant|hash element) in void context?

Scott Penrose scottp at dd.com.au
Sun Oct 5 18:52:33 CDT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>         my $statement=  "SHOW COLUMNS FROM ${table_names{$table}}";
>         my $sth=$dbh->prepare($statement);
>         $sth->execute();
>         my (%dbct, $dbr_ref);
>         while ($dbr_ref=$sth->fetchrow_hashref("NAME_lc")) {
>                 $dbct{$dbr_ref->{'field'}}=(
>                         type    =>      $dbr_ref->{'type'},
>                         key     =>      $dbr_ref->{'key'},
>                         blank   =>      $dbr_ref->{'null'}
>                 ); # Line 152
>         }
>         $sth->finish();

Found your problem...

>                 $dbct{$dbr_ref->{'field'}}={
>                         type    =>      $dbr_ref->{'type'},
>                         key     =>      $dbr_ref->{'key'},
>                         blank   =>      $dbr_ref->{'null'}
>                 }; # Line 152

You are assigning an array or list to a scalar - which does not work.

Instead, you need here to assign a hashref, which is the only way to 
assign a hash to a scalar.

Scott
- -- 
Scott Penrose
VP in charge of Pancakes
http://linux.dd.com.au/
scottp at dd.com.au

Dismaimer: If you receive this email in error - please eat it 
immediately to prevent it from falling into the wrong hands.

Please do not send me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (Darwin)
Comment: For info see http://www.gnupg.org

iD8DBQE/gK7EDCFCcmAm26YRAuufAJ4reTkY5n/At4wmKaa0RiZwBKYmwgCeJdNS
eNkuO7bJlSZDgfOwGRh4Z3Q=
=YLHL
-----END PGP SIGNATURE-----




More information about the Melbourne-pm mailing list