2025 Advent of Code Day 7 Part 1

Perl. Developed and tested with Perl 5.40.0. use v5 .40 ; my @grid ; open DATA, q/data/ ; while ( <DATA> ){ chomp ; push @grid , [ split // , $_ ]; } close (DATA); my $line = shift @grid ; my @beams = ([ 0 , ( grep { $line -> [ $_ ] eq q/S/ } 0 .. @ { $line } - 1 )[ 0 ]]); my $splits = 0 ; { $line = shift @grid ; my ( $s , $b ) = advance( \ @beams , $line ); $splits += $s ; @beams = @ { $b }; redo…