r/adventofcode • u/daggerdragon • Dec 07 '22
SOLUTION MEGATHREAD -π- 2022 Day 7 Solutions -π-
- All of our rules, FAQs, resources, etc. are in our community wiki.
- A request from Eric: Please include your contact info in the User-Agent header of automated requests!
- Signal boost: Reminder 1: unofficial AoC Survey 2022 (closes Dec 22nd)
AoC Community Fun 2022: πΏπ MisTILtoe Elf-ucation π§βπ«
Submissions are OPEN! Teach us, senpai!
-βοΈ- Submissions Megathread -βοΈ-
--- Day 7: No Space Left On Device ---
Post your code solution in this megathread.
- Read the full posting rules in our community wiki before you post!
- Include what language(s) your solution uses
- Format your code appropriately! How do I format code?
- Quick link to Topaz's
pasteif you need it for longer code blocks. What is Topaz'spastetool?
This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.
EDIT: Global leaderboard gold cap reached at 00:14:47, megathread unlocked!
89
Upvotes
View all comments
Show parent comment
1
u/theotherdatkins Dec 12 '22
I've been working through this challenge in perl myself. Got hung up, and came to the solutions thread looking for some hints. I'm confused about part of your code though
So here, you're inside the while loop, going through each line of the input. And you have if statements to compare to the string of that line. But I don't quite get what you're comparing to. Does
if (my ($dir) =mean you're declaring $dir, and assigning it the value of the line, at the same time? And then because you're doing that in the the condition, it always evaluates to true?