Hi , I have a hash with values as an array. {'col1'=>[1], 'col2'=>[1,2],'col3'=>[3,4,5]} And I have to insert the data from this hash to a database table. So I can't access the values from the traditional foreach loop since this would result in multiple entries depending on the number of keys. So I would like to get a way where I can access the multiple values without looping.
foreach my $results(@$hash_of_excel){ my $specificresults = GroupResults($results); insertResult($specificresults->{'Desc'}); #last if $counter++ == 2; } sub GroupResults{ my( $AllRecords )= @_; my %specificResults; for my $info (keys %details){ $specificResults{$info}{$_} = $AllRecords->{$_} for @{$details{$in +fo}; } } return \%specificResults; } sub SomethingUnPipeModifyRecord { my( $rec ) = @_; for my $val( values %$rec ){ my $newval = [ split /\|/, $val ]; $val = $newval; } return $rec; } sub insertL{ my ($li_results )= @_; my $liarray_values = SomethingUnPipeModifyRecord($ligand_results); #warn Dumper($li_array_values); warn "insert into LI values $li_array_values->{'Code'}[0],$li_array_v +alues->{'US'}[0],$li_array_values->{'IN'}[0],$li_array_values->{'STEM +'}[0]"; #my $ligand_insert = "insert into LI values(LI_SEQ.nextval,'SM',?,?,?,?,?,?,1,sysdate,?)"; }
I can access the first value but not the subsequent values Is there any smart way of doing this? Thanks a ton.

In reply to access array of values without a loop by spie287

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":