AoC day 4. Still pretty simple to solve with a couple of regexes. The hardest part was remembering to add the g flag to all matches.
use v5.36;$_ = do { local $/; readline };
my $n = index $_, "\n";
my $m = $n - 1;
my $o = $n + 1;
say
+ (() = /XMAS/g)
+ (() = /SAMX/g)
+ (() = /X(?=.{$n}M.{$n}A.{$n}S)/sg)
+ (() = /S(?=.{$n}A.{$n}M.{$n}X)/sg)
+ (() = /X(?=.{$m}M.{$m}A.{$m}S)/sg)
+ (() = /S(?=.{$m}A.{$m}M.{$m}X)/sg)
+ (() = /X(?=.{$o}M.{$o}A.{$o}S)/sg)
+ (() = /S(?=.{$o}A.{$o}M.{$o}X)/sg)
;
say
+ (() = /M(?=.{$o}A.{$o}S)(?=[^\n]M.{$m}A.{$m}S)/sg)
+ (() = /M(?=.{$o}A.{$o}S)(?=[^\n]S.{$m}A.{$m}M)/sg)
+ (() = /S(?=.{$o}A.{$o}M)(?=[^\n]M.{$m}A.{$m}S)/sg)
+ (() = /S(?=.{$o}A.{$o}M)(?=[^\n]S.{$m}A.{$m}M)/sg)
;