-
Indeed, this is why I like perl as it gives you fewer options for data structures.
If I was writing in python and I'd looked at part 1 and chosen a Set then I'd have needed to rewrite it as a Dict for part 2 where I needed to keep counts against the entries.
With perl there's no Set data type, you've got scalars, arrays and hashes (equivalent of python dicts) so I tend to default to hashes anyway.
Also with AoC you get used to the times where the optimal choices for part 1 often mean a bit of rewrite for part 2. I do the challenges to get the answer as fast as possible (not worrying about leaderboards, hence my 9.30am lie in this morning). Then I can go back and pretty it up and rewrite it in other languages at a later point in time.
Would have been far slower if I hadn't known about dictionaries. :)
https://github.com/TijmenK/AoC2020/blob/main/day6.py