There is no duplicate key at compile-time — the list is only created and assigned to the hash at run-time — so the answer to your literal question is "no".
However, it is possible to write an opcode checker that detects the posted code pattern at compile-time. (For example, module autovivification uses an opcode checker to not only examine opcodes, but to replace them.) This approach would probably be better to add a *run-time* warning.
A better approach to detecting the situation at compile-time would be to write a Perl::Critic rule to look for the code pattern you posted.
In reply to Re: Throw compilation error(or warning) if duplicate keys are present in hash
by ikegami
in thread Throw compilation error(or warning) if duplicate keys are present in hash
by I_love_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |