for $=finish.lines -> $line {
say $line if !($line ~~ m/^\;/ ff $line ~~ m/^\"/);
}
=finish
We hope Perl6 is wrote by the hole Socfilia
-- Larry Wall
; next is some lines to skip,include this line
fuck fuck fuck
dam dam dam
mie mie mie
" next is subject
Programming is hard,Let's go shopping
-- Larry Wall
Ruby is Another Perl6
-- Larry Wall
# --------------------------------------------------
my $excerpt = q:to/END/;
Here's some unimportant text.
=begin code
This code block is what we're after.
We'll use 'ff' to get it.
=end code
More unimportant text.
=begin code
I want this line.
and this line as well.
HaHa
=end code
More unimport text.
=begin code
Let's to go home.
=end code
END
say ( $excerpt ~~ m:s:g{\=begin code\s+(.+?)\s+\=end code} ).map( *.[0] ).join("\n\n")
# ------------------------------------------------------
my $excerpt = q:to/END/;
Here's some unimportant text.
=begin code
This code block is what we're after.
We'll use 'ff' to get it.
=end code
More unimportant text.
=begin code
Today rains heavy.
Long live AI .
HaHa
=end code
More unimport text.
=begin code
Like to go home.
=end code
END
my @codelines = gather for $excerpt.lines {
take $_ if "=begin code" ff "=end code"
}
# this will print four lines, starting with "=begin code" and ending with
# "=end code"
#say @codelines.join("\n");
my @lines = gather {
my @current;
for $excerpt.lines {
if "=begin code" ^ff^ "=end code" {
push @current, .trim;
} else {
if @current {
take @current.List;
@current = ();
}
}
}
}
.Str.say for @lines;
## 比较前后两条时间差是否大于 5 分钟
.say if (.max - .min) >= 5 * 60 * 1000 for $=finish.lines.rotor(2 => -1);
=finish
1564627891000
1564627892000
1564627893000
.............
## rotor
my %re;
for 'input.txt'.IO.lines».rotor(2, :partial) -> $header, $data {
my $key = $header;
$key ~~ s/<upper>$//;
%re{$key} ~= $data;
}
for %re.kv -> $key, $value {
say "$key\n$value";
}