Skip to content

Instantly share code, notes, and snippets.

@zoffixznet

zoffixznet/p6.p6 Secret

Created July 17, 2018 16:07
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 zoffixznet/1670ac204a8f13a8eb2a3bf252eb94de to your computer and use it in GitHub Desktop.
Save zoffixznet/1670ac204a8f13a8eb2a3bf252eb94de to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
use nqp;
my $res := nqp::list;
my $lines := nqp::split("\n", 'foo.txt'.IO.slurp);
nqp::pop($lines);
my int $e = nqp::elems($lines);
my int $i = -1;
nqp::while(
nqp::islt_i(++$i, $e),
nqp::stmts(
(my $l := nqp::split(' # ', nqp::atpos($lines, $i))),
nqp::bindpos($res, nqp::atpos($l,0)-1, nqp::split(' ', nqp::atpos($l,1)))));
say nqp::elems($res);
say now - INIT now;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment