in reply to Why doesn't exist work with hash slices?
Something like exists %haystack{@slice} might be a workaround
Also the semantic with first that you propose isn't intuitive for me.
But
would be the obvious choice and probably wouldn't merit magic sugar.¹
If anything this might be an argument for hyper operator syntax, which could be combined with various simple operators like exists.
Finally your goal might be possibly achieved with aliasing², I'll test and update here if it's possible.
In hindsight: This is all semantically very close to calculating a set intersection, but alas not easy in Perl.
¹) though there is a precedent with delete @hash{@slice} which returns a list
²) no, doesn't work an exists $_ doesn't compile
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
---|