Thanks Uri and Parag. After reading your comments and taking a coffee, I understand it. :)
Thanks, Bruce. On Sun, Nov 15, 2009 at 12:18 AM, Uri Guttman <u...@stemsystems.com> wrote: > >>>>> "PK" == Parag Kalra <paragka...@gmail.com> writes: > > first off, as a newbie here, please learn to bottom post. reading is > done top down so put your comments BELOW the quoted and edited post you > are commenting about. > > PK> Even I am a beginer but let me throw some pointers. Experienced > PK> users kindly correct me if I am wrong.... > > will do. but it is better for newbies to wait until they have a question > they can answer. what if the OP took your (incorrect) answer and decided > this list is full of people who don't know perl? there are plenty here > to help out and people of all skills are here. best to learn more before > you help and steer someone in a bad direction. > > >> use constant 'cache_result' => {}; > >> > > PK> First line is declaring a constant. What I could not get is that what > PK> constant are we trying to declare i.e a variable, hash or a reference. > PK> Read more - perldoc constant > > see, i put the code ABOVE your comment so it is easy to see what you are > talking about. this is called bottom posting where you intersperse your > comments below the previous message parts. > > and yes, that is declaring a constant. you can tell it is a hash as it > is initialized to a hash reference. it makes little sense to me why you > would declare such a beast as the reference can have its contents > altered and so it really isn't constant. the symbol 'cache_result' can't > have its value changed from the initial hash reference. > > PK> And then there is a function which perhaps is returning a reference to > PK> something. > > >> sub abc { > >> ............ > >> ........... > >> return cache_result->{$self->name}; > >> > >> } > > well, without more code we can't tell what this means. we can make some > educated guesses. $self usually means there was some object > created. name would be a method of that object, likely an accessor. so > the constant hash ref is caching some stuff based upon the name inside > the object. that is what is being returned. it would be easy to tell the > full story with more code but that is as far as i can tell from the > snippet here. > > PK> Sorry for this vague kind of answer but even I am in process of > learning > PK> Perl. :) > > keep learning more perl. you weren't far off here but accuracy is > important when answering technical questions. vague ideas and guesses > are not good things here. > > thanx, > > uri > > -- > Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com-- > ----- Perl Code Review , Architecture, Development, Training, Support > ------ > --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com--------- >