in reply to Re^6: multi level hash terror - if statement to access specific elements
in thread multi level hash terror - if statement to access specific elements

Sorry that's a typo...but using the correct equality operator still results in all surnames getting printed

Are all the surnames "Gay"?

Is this what you have?

my %names = ( abe => { lincoln => [ 'Cheddar', 'Cheddar', ], }, george => { washington => [ 'Gay', 'Gay', ], }, ); for my $key ( keys %names ) { for my $key2 ( keys $names{$key} ) { if ( $names{$key}{$key2}[0] eq 'Gay' ) { print "Last Name:" . $names{$key}{$key2}[1] . "\n"; } } } __END__ Last Name:Gay

There is no lincoln/cheddar printed

  • Comment on Re^7: multi level hash terror - if statement to access specific elements
  • Download Code