Re: hash reference help

2005-05-24 Thread Ing. Branislav Gerzo
Offer Kaye [OK], on Wednesday, May 25, 2005 at 09:09 (+0300) typed the following: >> it was easy mistake, everything we should know about this is avoid >> using keys() on %$hr in while loop, because it resets iterator. That's >> all. OK> Well, that, and don't change the hash inside the while loo

Re: hash reference help

2005-05-24 Thread Offer Kaye
On 5/24/05, Ing. Branislav Gerzo wrote: > > it was easy mistake, everything we should know about this is avoid > using keys() on %$hr in while loop, because it resets iterator. That's > all. Well, that, and don't change the hash inside the while loop. In your original email you wrote: "and get_s

Re: hash reference help

2005-05-24 Thread Ing. Branislav Gerzo
Charles K. Clarkson [CKC], on Tuesday, May 24, 2005 at 08:16 (-0500) thinks about: CKC> It would be helpful to know what $hr looks like. Do this, and then CKC> show us what it looks like. Show a partial dump if this is too long. CKC> use Data::Dumper 'Dumper'; CKC> print Dumper $hr; in select

RE: hash reference help

2005-05-24 Thread Charles K. Clarkson
Ing. Branislav Gerzo wrote: : Hi beginners@perl.org, : : I fetch results from table with fetchall_hashref, here is my snippet: : : my $hr = $get->fetchall_hashref('id'); It would be helpful to know what $hr looks like. Do this, and then show us what it looks like.

hash reference help

2005-05-24 Thread Ing. Branislav Gerzo
Hi beginners@perl.org, I fetch results from table with fetchall_hashref, here is my snippet: my $hr = $get->fetchall_hashref('id'); while (my ($id, $value) = each(%$hr)) { get_something(); } sub get_something { foreach my $k ( reverse sort { $hr->{$a}{counter} <=> $hr->{$b}{counter} }