Re: Return keys from $db->DataHash directly into an array
- From: Mike Pomraning <mjp-nntp@xxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 16 Sep 2007 20:37:28 GMT
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
.
- References:
- Return keys from $db->DataHash directly into an array
- From: dtshedd
- Return keys from $db->DataHash directly into an array
- Prev by Date: Re: Getting WWW::Mechanize to submit a form
- Next by Date: Re: $db->DataHash does not return keys/fields in same order as they appear in database
- Previous by thread: Return keys from $db->DataHash directly into an array
- Next by thread: $db->DataHash does not return keys/fields in same order as they appear in database
- Index(es):