Quick actions

cmd+k|ctrl+k

Navigation

Languages

Split code and comments

Snippet info

Language

Raku

Visibility

public

Author

fernando-correa

Created

2022-08-18T15:42:16.242858Z

Updated

2022-08-18T15:42:16.242858Z

my $code = q:to/END/;
print 42; # meaning of life
say "more code"; # more comment
END

my ($code-only, $comments) = [Z~] $code.lines>>.split: "#";
say $code-only;
say $comments;
INFO