By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,263 Members | 2,640 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,263 IT Pros & Developers. It's quick & easy.

How to print Hash, hash of hash in Perl?

P: 47
print Dumper($englishTB);

==> this is a result
Expand|Select|Wrap|Line Numbers
  1. $VAR1 = bless( {
  2.                  'TEXT' => 'english- This is a text ', 
  3.                  'LANGUAGE' => bless( {
  4.                                         'ID' => '3',
  5.                                         'NAME' => 'English'
  6.                                       }, 'Language' )
  7.  
However, by now, I want to use find some ways to print out the hash
Expand|Select|Wrap|Line Numbers
  1. while (my ($key, $value ) = each (%$english)){
  2.          print "$key =>  $value ". "\n";
  3.     while (my ($key, $value ) = each (%$value)){
  4.          print "$key =>  $value ". "\n";
  5.     }
  6. }
  7.  
it gives me an error as
TEXT => Engish - E-mail account blance.
Can't use string ("Engish - E-mail account blance"...) as a HASH ref while


Thank you
Mar 7 '11 #1

✓ answered by numberwhun

You may want to book mark this link as it has helped me out a lot in the past.

Regards,

Jeff

Share this Question
Share on Google+
1 Reply


numberwhun
Expert Mod 2.5K+
P: 3,503
You may want to book mark this link as it has helped me out a lot in the past.

Regards,

Jeff
Mar 7 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.