I have a piece of code that parses this data structure to get the value( { col1 =>value1 col2 =>value2 col3=>value3|value4 col4=>value5|value6|value7 }, { col1 =>value8 col2 =>value9 col3=>value10|value11|value12 col4=>value13|value14|value15 } { col1 =>value16|value17 col2 =>value19|value18 col3=>value20 col4=>value21 } )
This would result me in the same value printing over n over for the number of columns present in each hash (ie 4 in our case). My question is how can I access different col for the DBI insert but without having to go through lot of for loops? And is there a way to check if the value has more than one values and pushing them to array instead of having to get all of them in an array? OR is this good to have the DBI inserts to a different sub routine and pass jus the required column values in an array? Please help. Thanks in advance.foreach my $results (@$hash_of_excel){ for my $colname( sort keys %$results){ my @array = split /\|/,$results->{$colname}; foreach my $value (@array){ warn $results->{'col1'}, $results->{'col2'},$results->{'co +l3'}; last; } } last if $counter++ == 2; }
In reply to logical solution for a array of hash by spie287
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |