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} } 
(keys( %$hr )) ) {
            print $k;
    }
}

The troubles goes in while loop. Ofcourse there are some more things
inside, and get_something() change the hash - when I call
it, it gives me strange results (unitialized value...) in while loop.

Could someone give me advice how to do that ?

Thanks a lot.

--

 --. ,--  ,-     ICQ: 7552083      \|||/    `//EB: www.2ge.us
,--' |  - |--    IRC: [2ge]        (. .)    ,\\SN: 2ge!2ge_us
`====+==+=+===~  ~=============-o00-(_)-00o-================~
"What the hell is that?" Chekov
 




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to