The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl hashes "Can't use subscript on private hash" Smiling Dragon Shell Programming and Scripting 9 07-27-2008 07:42 PM
Awk Hash Function. dinjo_jo Shell Programming and Scripting 2 07-16-2008 06:30 PM
Hash within array, within hash, within array... jsmoriss Shell Programming and Scripting 1 07-10-2006 09:26 PM
getting data list into a hash array topcat8 Shell Programming and Scripting 5 03-09-2004 12:02 PM
Hash (#) as a variable errolg UNIX for Dummies Questions & Answers 5 05-21-2002 03:03 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-06-2008
Alalush Alalush is offline
Registered User
  
 

Join Date: Jul 2008
Location: Israel
Posts: 21
Print Entire hash list (hash of hashes)

I have a script with dynamic hash of hashes , and I want to print the entire hash (with all other hashes).
Itried to do it recursively by checking if the current key is a hash and if yes call the current function again with refference to the sub hash.
Most of the printing seems to be OK but in some of them I'm getting :
HASH(0x98f3dc8)

Any suggestions how can I implement this ?
  #2 (permalink)  
Old 08-06-2008
buffoonix buffoonix is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 145
I guess you are talking of a Perl script here.
What you see is when you try to print a Perl hasref.
To see its contents you need to derefernce it like e.g.
Code:
print map "$_\n", keys %{$some_hashref};
The easiest way to gain instant insight into your nested data structures
would be to load your script into the Perl debugger
(just issue "$ perl -d /path/to/yourscript.pl")
Then continue to a line (type c line#) where your data structure
has been built up or autovivified.
Then type "|x $hashref" or "|x \%hash" and page through your LoL.
You also could use the
Code:
Data::Dumper
module in your script.
See its POD for details.
Oh no, I hate those silly auto-inserted smileys as in Dumper above)

Last edited by jim mcnamara; 08-06-2008 at 09:53 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:38 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0