Re: assigning hash to a scalar

2011-03-27 Thread Chas. Owens
On Sat, Mar 26, 2011 at 12:05, Brian Fraser wrote: > Chas++ > > I don't get to see Algorithms in college, so I doubly appreciate > explanations like this, in the one language I sort of grok* :) You've made > my morning, thank you! snip Be warned, my implementation is incredibly naive and ineffici

Re: assigning hash to a scalar

2011-03-26 Thread Shlomi Fish
Hi Chas, and Brian (and all), On Saturday 26 Mar 2011 18:05:33 Brian Fraser wrote: > Chas++ > > I don't get to see Algorithms in college, so I doubly appreciate > explanations like this, in the one language I sort of grok* :) You've made > my morning, thank you! Well, I've only skimmed Chas' res

Re: assigning hash to a scalar

2011-03-26 Thread Brian Fraser
Chas++ I don't get to see Algorithms in college, so I doubly appreciate explanations like this, in the one language I sort of grok* :) You've made my morning, thank you! Brian. *Also the reason I'm trying to hunt down a copy of Mastering Algorithms with Perl. On Sat, Mar 26, 2011 at 8:40 AM, Ch

Re: assigning hash to a scalar

2011-03-26 Thread Chas. Owens
On Sat, Mar 26, 2011 at 03:53, Sunita Rani Pradhan wrote: > Thanks Alan . I had got this piece of info from google but I do not > understand clearly what it wants to define . It would be good  , if you > can explain bit more . snip If you want to know how many key/value pairs are in a hash, you c

Re: assigning hash to a scalar

2011-03-26 Thread Alan Haggai Alavi
Hi Sunita, Thanks Alan . I had got this piece of info from google but I do not understand clearly what it wants to define . It would be good , if you can explain bit more . You are welcome. The numbers are dependent on the internal hashing algorithm used by perl of which I am unaware of. Hop

RE: assigning hash to a scalar

2011-03-26 Thread Sunita Rani Pradhan
1:19 PM To: Sunita Rani Pradhan Cc: beginners@perl.org Subject: Re: assigning hash to a scalar Hi Sunita, > $var = %input; > ... > Output : 3/8--> What does this output mean ? You are evaluating a hash in a scalar context. Quoting perldata: If you evaluate a hash in scalar

Re: assigning hash to a scalar

2011-03-26 Thread Alan Haggai Alavi
Hi Sunita, $var = %input; … Output : 3/8--> What does this output mean ? You are evaluating a hash in a scalar context. Quoting perldata: If you evaluate a hash in scalar context, it returns false if the hash is empty. If there are any key/value pairs, it returns true; more precisely,