Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
There's more than one way to do things
 
PerlMonks  

Have you worked to get it?

by tilly (Archbishop)
on Sep 19, 2000 at 16:24 UTC ( [id://33121]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to RE: RE: RE: RE: RE: RE: Re: Populating a Hash: Can someone help me to understand?
in thread Populating a Hash: Can someone help me to understand?

If you look at something and are confused, try to work out what it is saying. Take some guesses and experiment a few times. But basic concepts (like references) are not something someone can hand you on a platter. They can show you working code examples, but until you "get it" you will not figure out how it works. And if you first response to confusion is to ask another question then you are unlikely to ever learn how it works.

I am sorry if this sounds harsh, it isn't meant to be. Some things just don't come easily.

A reference is just a special kind of value that "points at" another Perl data structure. Nothing more, nothing less. A value of a hash has to be a single value. But that value can tell you where an array is that contains a whole list of arrays. You can now do the same things that you could do with a list of values, but you have to remember to always work with one level of indirection (called dereferencing) to get at the list.

If that doesn't make sense then please do not ask a question about it. Instead go back to the code example you did not understand and look for the dereferencing. If you don't see it then read the explanations given there and other places for how you can create and destroy the reference. Play with it. Experiment with it.

Enlightenment won't all come at once, but develop the habit of first digging into your own mental resources, then asking questions, and you will both learn faster and ask more productive questions.

This is called "learning to learn" and the best way to learn that is go to work right now and figure out this concept for yourself, because nobody can hand you comprehension on a silver platter, it just does not work that way.

Replies are listed 'Best First'.
RE: Have you worked to get it?
by Limo (Scribe) on Sep 19, 2000 at 17:27 UTC
    Absolutely! Spent about 2 hours or so, trying different permutations, throwing in print statements along the way, to see where things fail.
      I think you are treating this as unknown code to try and figure out, rather than as an unknown concept to master. Instead of trying random tinkering and syntax from working code, try a series of exercises. Such as this:
      1. Read Data::Dumper's documentation.
      2. Pass Data::Dumper a reference to an array and see what it gives you.
      3. Take a reference to an array and try to get a specific element from that.
      4. Loop through the elements of an array which you have a reference to.
      5. Repeat with hashes.
      6. Repeat with various combinations of nested arrays and hashes.
      7. Then try to see if you understand and could explain to someone else who understood references the code which puzzled you.
      Please try that.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://33121]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.