hash slices



I'm using DBI's selectall_hashref with 5 key columns. I want to display
each row where key col 1 is 'yes' or NULL (undef or '' ?)


foreach my $medCategory (keys
%{$href->{'yes'}->{qw('' 'yes')}->{qw('' 'yes')}}) {
foreach my $med (keys
%{$href->{qw('yes')}->{qw('' 'yes')}->{qw('' 'yes')}->{$medCategory}}) {
foreach my $ID (keys
%{$href->{qw('yes')}->{qw('' 'yes')}->{qw(''
'yes')}->{$medCategory}->{$med}}) {


print qq{ $href->{qw('yes')}->{qw(''
'yes')}->{qw('' 'yes')}->{$medCategory}->{$med}->{$ID}->{ID} };
print qq{ $href->{qw('yes')}->{qw(''
'yes')}->{qw('' 'yes')}->{$medCategory}->{$med}->{$ID}->{Medication} };
}
}
}

This isn't working of course because I don't quite understand the syntax I
need. Can someone give me a hint? Thanks!

Ryan

Relevant Pages

  • Re: software engineering, program construction
    ... foreach my $site (keys %}) ... the charts to a PDF document for distribution. ...
    (comp.lang.perl.misc)
  • Re: OO new
    ... bless $self, $pkg; ... foreach (keys %opts) { ...
    (comp.lang.perl.misc)
  • Re: How to loop through Hashtable keys without using foreach
    ... The problem isn't the foreach but how you're using the data. ... looping through the keys and then again looking up each value by key ... Developers for exciting positions in medical product ... foreach (string propertyName in ht.Keys) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: sort array by values
    ... of it's keys). ... but you can't tell the sort and search functions to ... Having [array] return a more useful ... foreach { ...
    (comp.lang.tcl)
  • Dynamically Created If Statment
    ... "INQUIR-1" ... foreach $item (sort num keys %detail_def){ ... it simply ignores the $stmt bit, same if i use eval $stmt instead, however ...
    (perl.beginners)