in reply to Hash/Array slice : how to exclude items?

Hi.
It is a very good question and a good wish!

As I understand from above replies, there are no such feature in core Perl.
You need either to use another hash to store specific keys to filter, either you need to copy the whole hash and delete items from it.

In my opinion, it is a good feature request. It could be named 'hide' function. You hide some keys, and later unhide them. And also an additional function 'visible' could be a sister to 'exists'.

Another idea is that hash with hidden keys is a subhash. Possibly there could be several kinds of 'hide' on the same hash, then rather it should be a color of particular subhash. And the simple way to color a hash is to add another dimension of hash: from $hash{ $key } = $value make $hash{ $key }{ 'hidden' } = 1; $hash{ $key }{ 'value' } = $value; (instead of 'hidden', you can use any e.g. '<color>', if you want to make several subhashes).