On Fri, Apr 16, 2010 at 7:47 AM, Steve Bertrand <st...@ibctech.ca> wrote:

> On 2010.04.15 03:37, raphael() wrote:
> > On Thu, Apr 15, 2010 at 10:55 AM, Uri Guttman <u...@stemsystems.com>
> wrote:
> >
> >>>>>>> "r" == raphael()  <raphael.j...@gmail.com> writes:
> >>
> >>  r> # abc      <-- this_should_be_hash_name
>
> >> the proper solution is to use a hash to hold these hashes. this is
> >> cleaner, safer, allows you to isolate this data, pass it around easily,
> >> reclaim its memory when it is not being used anymore, etc.
>
> >> so just declare a top level hash like this:
> >>
> >> my %top_data ;  # pick a better name
> >>
> >> and then just assign into it the data you want with an anonymous hash:
> >>
> >>        $top_data{ $1 } = { $2 => $3 } ;
>
> >>
> >> read these docs for more on this:
> >>
> >>        perlreftut
> >>        perldsc
> >>        perllol
> >>
>
> > But as a beginning Perl programmer I find references extremely
> complicated.
> > Although I have to learn them sometime.
>
> Although I Am Not A Programmer, if you do actually desire spending time
> on writing Perl code, my strong advice would be to ingrain references
> into your head as soon and as fast as possible.
>
> Once you have a clear understanding of how $, @ and % work, spend as
> much time as it takes to learn about references.
>
> I can personally assure you that if you put references off because they
> seem intimidating, you will waste years of writing one-off scripts, that
> when you look back on them, you will condemn yourself.
>
> Perhaps that is easy to say when I have an 'ok' understanding of Perl
> references, but nonetheless, I'd hate to see anyone else make the same
> mistake of forgoing them like I did.
>
> My excuse was that I had been exposed to so many different usage idioms
> by so many different people by reading many different books and online
> information (especially the {} enclosure stuff), that it isn't worth
> learning.
>
> Don't fret. The learning curve isn't really that insurmountable. Read
> lots, and practice. If you are determined, then in a very short time,
> the light will go on, and all of a sudden, you'll have your own style of
> populating and extracting multi-level structures, and you'll even be
> able to understand them in other people's style (or at least know what
> to Google for).
>
> fwiw, a dispatch table (as discussed in another thread) is created
> entirely with references. Many people use dispatch tables to automate
> processes that follow the rabbit no matter how deep the hole, or how
> many branches the hole has ;)
>
> > Going to code now. Will be back if I get stuck && *thanks* all.
>
> Good luck, there's always been someone here to provide feedback.
>
> Steve
>

It always comes down to desire and will to do something.
I agree that had I mastered references most of the things I have created in
Perl would have
been really easy to create instead I always looked for ways to bypass my
need to use references!

You were right I was actually putting references off (was going to learn
them *later*).
Your post actually gave me the motivation required to solely dedicate time
to *references* alone.
Lets see why I cannot ingrain them in my head. Reading your post Steve
actually felt good :)
You know when someone speaks from experience. *thanks again*

Reply via email to