in reply to Re: How to print the 10 most recent (epoch) keys in a hash when epoch is not the key
in thread How to print the 10 most recent (epoch) keys in a hash when epoch is not the key
can also be written asdelete $hash{ pop @epochOrderKeys } while @epochOrderKeys > 10;
$#epochOrderKeys = 9 if $#epochOrderKeys > 9;
It doesn't remove the records from %hash, but there's no need to. The following would proceed to remove them if so desired:
%hash = @hash[ @epochOrderKeys ];
|
|---|