in reply to Variable scalar creation.

If you must use symbolic references, you should turn off strict refs in as small a section of code as possible.
use strict; $db->FetchRow(); my @names = $db->FieldNames(); my @values = $db->Data(); no strict "refs"; ${$names[$_]} = $values[$_] for 0..$#names; use strict;

By the way, while ($names[$arraycnt] ne '') is an infinite loop. Uninitialized entries in an array are undef, not ''.

Replies are listed 'Best First'.
Re^2: Variable scalar creation.
by Thelonious (Scribe) on Feb 13, 2005 at 11:43 UTC
    undef is converted to the empty string when comparing it to a string. Give it a try:

    print "ne" while(undef eq '');
    hth
Re^2: Variable scalar creation.
by snappybo (Initiate) on Feb 13, 2005 at 08:32 UTC
    re: By the way, while ($names$arraycnt ne '') is an infinite loop. Uninitialized entries in an array are undef, not ''.

    just tried something after you said this, i.e. got the loop to count and print the number every time it loops and it only counts to the exact number of the fields in the db, so it must have read the undef to equal ''?