Re: Return keys from $db->DataHash directly into an array



dtshedd@xxxxxxxxx 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) {
@fields[$i]=$key;

Please read perlfaq4, "What is the difference between $array[1] and @array[1]?"

In any case, this is a data structure question, not a module-specific question. Try ``@fields = keys %hash'' after you've read the FAQs.

Regards,
Mike
.