Brent Clark wrote:

Hi all

I my thanks to all whom have tried to help me earlier, but alas, I still cant seem to get this right.
I know this gonna kick me because it will be a stupid small mistake.

my ($ref_hash,  $fileName) = @_;
foreach my $roomCode ( keys %{ $ref_hash->{$fileName} }){

foreach my $rmData ( keys %{ $ref_hash->{$fileName}->{$roomCode} } ){ print $ref_hash->{$fileName}->{$roomCode}->{$rmData}; #Nothing gets displayed
        }

print does not display anything.

Because $ref_hash->{$fileName}->{$roomCode} is the string you want and not a hashref:


my $ref_hash = {
   'Grac01' => {
      'StndRm' => 'Standard Room',
      'Suite' => 'Suite',
      'Pent' => 'Penthouse'
   },
};

for(keys %{ $ref_hash->{'Grac01'} }) {
   print "$ref_hash->{'Grac01'}->{$_}\n";
}


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to