The first version does not allow for empty @ARGV; both versions do not allow for the possibility that @ARGV may have repeated elements.
I think a short form that preserves all the current behaviour could look like this:
... next unless $y; $Y{$y} += @ARGV ? (grep $y eq $_, @ARGV) : 1;
It would, though, be preferable to have some clue about what the code is intended to achieve: it is always possible that the behaviour on repeated elements is unintentional or irrelevant.
In reply to Re^2: Code review
by hv
in thread Code review
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |