Post History
Perl, 26 bytes sub c{my%c;map++$c{$_},@_} Walk the list, incrementing and returning the associated hash element. Will work on a list of any items that can be stringified to make the hash key...
#1: Initial revision
# [Perl], 26 bytes
<!-- language-all: lang-perl -->
sub c{my%c;map++$c{$_},@_}
Walk the list, incrementing and returning the associated hash element.
Will work on a list of any items that can be stringified to make the hash keys, not just integers.
[Try it online!][TIO-mmk37giv]
[Perl]: https://www.perl.org/
[TIO-mmk37giv]: https://tio.run/##RYzdSsNAEIXv8xSHdQNKptQkbUVD/bkpiIIPsF1CjFuNtEnciRdS6qO7blaKHGY4nPnm9MZu587x5zPq/e4rrotd1SeJrPeyPNBteXAn2HQWg@EBb5VtDXMkrWEswb1t2mEDoWLWgvDeNa0gb2rIlTrXy@/p@iWZvhbREYwZV/Ar5rUnIUs/votwGirNx/iYadxAPD0Iz4rV3f2jOCucSimlLCgNyinXmFxDpSHKxoBmNB@9jlROF97P6DJcMlrQ4oj/66/N4z9dPzRdy25SbX8B "Perl 5 – Try It Online"
