Sombrerero_loco has asked for the wisdom of the Perl Monks concerning the following question:

Why when i print this to ha file:
foreach $prt_nombre (keys (%db)) { foreach $prt_indice (0..$#{ $db{$prt_nombre}} ) { printf ficherolog "$ahora - Operativa: $db{$prt_nombre} || Vec +es encontrada: $db{$prt_nombre}[$prt_indice]{'contador'}\n"; } }
It only prints me the name in memory of the array.
12/02/2009 13:28:03 - Comienzo de tarea... 12/02/2009 13:28:03 - Operativa: ARRAY(0x1ae2984) || Veces encontrada: + 0 12/02/2009 13:28:03 - Operativa: ARRAY(0x19c8fcc) || Veces encontrada: + 0 12/02/2009 13:28:03 - Operativa: ARRAY(0x289c34) || Veces encontrada: +0 12/02/2009 13:28:03 - Operativa: ARRAY(0x289c34) || Veces encontrada: +0 12/02/2009 13:28:03 - Operativa: ARRAY(0x289c34) || Veces encontrada: +0 12/02/2009 13:28:03 - Operativa: ARRAY(0x19c8ebc) || Veces encontrada: + 0 12/02/2009 13:28:03 - Operativa: ARRAY(0x1ae2274) || Veces encontrada: + 0 12/02/2009 13:28:03 - Operativa: ARRAY(0x1ae2e94) || Veces encontrada: + 0 12/02/2009 13:28:03 - Operativa: ARRAY(0x1ae2e94) || Veces encontrada: + 0 12/02/2009 13:28:03 - Operativa: ARRAY(0x1ae2354) || Veces encontrada: + 0 12/02/2009 13:28:03 - Operativa: ARRAY(0x1ae2354) || Veces encontrada: + 0 12/02/2009 13:28:03 - Tarea finalizada
Sure im doing something wrong... Thanks!!!!!!

Replies are listed 'Best First'.
Re: Simply && Fast question regading HASH-ARRAY-HASH data access
by Corion (Patriarch) on Feb 12, 2009 at 14:53 UTC
Re: Simply && Fast question regading HASH-ARRAY-HASH data access
by jethro (Monsignor) on Feb 12, 2009 at 14:28 UTC

    You probably wanted this

    printf ficherolog "$ahora - Operativa: $prt_nombre ...

    As you seem to have an Hash of Arrays, the hash values have to be pointers to the array, not any printable value. If you need that, you might store that value into the first element of the array

Re: Simply && Fast question regading HASH-ARRAY-HASH data access
by JavaFan (Canon) on Feb 12, 2009 at 14:25 UTC
    If you have the knowledge of determining a question is 'simple && fast', why don't you seek the answer yourself?

    Having said that, $db{$prt_nombre} is a reference to an array. In string context, that gives you 'ARRAY(hex_number)'. If you want to print a specific element, use an index (as you do elsewhere in the string). Otherwise, flatten the array.

Re: Simply && Fast question regading HASH-ARRAY-HASH data access
by ikegami (Patriarch) on Feb 12, 2009 at 14:24 UTC

    What would you expect a reference to an array to look like?

    You didn't tell us what would you like to print out instead, so there's not much we can do to help. I would normally assume you want to display the contents of the referenced array, but said array contains equally unreadable hash references.