in reply to LeetCode Problem #1 - Two Sum - Improve and/or discuss.

Both concise and weird. And no, it's not really golfed. I just wanted to see if this would work.

sub two_sum # O(n) { my ($i, $input, $target, %h) = (0, @_); return [ $h{$_} // ($h{$target - $_} = $i++, next), $i ] for @$input +; }