Lawrence's emendation stopped the extra executions, but Jay's also preserved
the original intent, which was to get the hash sorted according to $capval
being purely numeric.

Thanks to both, rgds, GStC. 

[cut] 

> my $counter = 0;
> foreach $capval ( sort bynumber %capdef ) {
>   $counter++; # debug
> ...

[cut]

> 'print 2' shows 171 items as expected.
> And then --- I get Haha!172 thru Haha!342 from 'print 3'.
> What is going on that I haven't understood?
> 
> Rgds, GStC.

Graeme,

I think you're looking for:

foreach $capval ( sort bynumber( keys %capdef) ) {

I forget what exactly 'sort %hash' (as opposed to 'sort keys %hash') does,
but not what you want.

HTH.

--jay

-- 
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