Return keys from $db->DataHash directly into an array
Is there anyway to pass just the keys of a data hash directly into an
array or is it necessary to do something like this?
$db->Sql("SELECT * FROM Groups");
$db->FetchRow();
%hash = $db->DataHash;
foreach $key (keys %hash) {
[at] fields[$i]=$key;
print "my field $fields[$i]\n";
$i++;
}
TIA
dan
Re: Return keys from $db->DataHash directly into an array
dtshedd [at] yahoo.com wrote:
> Is there anyway to pass just the keys of a data hash directly into an
> array or is it necessary to do something like this?
Please identify the name of the module in question (Win32::ODBC, in this
case).
> $db->Sql("SELECT * FROM Groups");
> $db->FetchRow();
> %hash = $db->DataHash;
> foreach $key (keys %hash) {
> [at] fields[$i]=$key;
Please read perlfaq4, "What is the difference between $array[1] and
[at] array[1]?"
In any case, this is a data structure question, not a module-specific
question. Try `` [at] fields = keys %hash'' after you've read the FAQs.
Regards,
Mike