diff --git a/09/2.pl b/09/2.pl new file mode 100644 index 0000000..4a0941b --- /dev/null +++ b/09/2.pl @@ -0,0 +1,24 @@ +use 5.20.0; + +my $stream = <>; +chomp $stream; + +my $garbage; +$stream = clean_stream($stream); + +say $garbage; + +use experimental qw/signatures /; + +sub clean_stream($s) { + + return $s unless $s =~ s/^(.*?))// ) { + warn $1; + $garbage += length $1; + last if $2 eq '>'; + } + + clean_stream($s); +} diff --git a/09/test b/09/test new file mode 100644 index 0000000..9a05711 --- /dev/null +++ b/09/test @@ -0,0 +1 @@ +{{},{},{},{}}