while (($_) = sort keys %data){
print "while: $data{$_}\n";
delete $data{$_};
}
This is a pretty expensive loop. You'd be much better doing:
while (my ($k, $v) = each %data) {
print "key is $k, value is $v\n";
}
Without those parens around $_, I would expect it to try to pass '5' into the block (which it would do) if you took away the sort function, but it doesn't do that. I suppose that might qualify as an insignificant bug.
No, sort in a scalar context always returns undef. Maybe someday, it'll
return something useful. But not yet. No bug, except in perhaps your understanding. {grin}
-- Randal L. Schwartz, Perl hacker