Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
zing: It's not enough to simply include Data::Dumper, you actually have to call it. Add print Dumper(\%HoA),"\n"; to the end of your script to let it help you out. The slightly longer answer is this: If you want to display the structure of the data, you have to treat different data items differently. So you'd have to create a subroutine that would look at the data and handle each type differently, something like:
But after writing something like this, you'll probably only wind up with your own customer version of Data::Dumper anyway. But the point is that when you print a string or number, perl knows what you want: it prints the text representation of the value. For something that's a reference to some other thing, though, there are too many different ways to format the data for perl to pick out a good one for you. So it settles for telling you *what* the thing is, and a token that lets you tell whether it's the same item as another one you printed. There are different ways to display arrays, hashes and objects, so there are different packages to handle them. Notes:
...roboticus When your only tool is a hammer, all problems look like your thumb. In reply to Re: Problem printing/storing hash
by roboticus
|
|