Skip to content

Instantly share code, notes, and snippets.

@sugyan
Created February 13, 2024 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sugyan/3a5e26f4ea89875ccac96dfc78ff4b9c to your computer and use it in GitHub Desktop.
Save sugyan/3a5e26f4ea89875ccac96dfc78ff4b9c to your computer and use it in GitHub Desktop.
YAPC::Hiroshima 2024 Perlbatross
(chop,utf8::decode$_)^print/(\X)\X?/g,$",/\X(\X)/g,$/for<>
map{for$a(18..ord){tr/ab-z/za-y/}print}<>
for(<>){/(\d+).{3} .*?" (.)/;($h[$1]||=[(0)x4])->[$2-2]++}for(@h){print"@$_$/"if$_;last if$_->[3]>10}
use v5.10;sub p{pop@s}sub u{push@s,@_}@p=<>;o();sub o{my$a=pop;while(@p>$c){$_=$p[$c++];chop;if($a&&/un/){last if!p();$c=$a;next}s/^=/==/;given($_){when(/[\+\-\*\/%<>=]=?/){$i=p();u eval p().$_.$i}when(/^d/){$i=p();u$i,$i if/dup/}when(/^s/){u p(),p()}when(/\.|cr/){print/cr/?$/:p()}when(/if/){if(p()){o();$c++while$p[$c]!~/then/;$c++}else{$i=1;while($i){$_=$p[$c++];$i++if/if/;$i--if/el/}}}when(/^el|^th/){last if/el/}when(/^b/){o($c)}default{u$_}}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment