eq ne lt le gt ge
~~ =:= === eqv
!== !~~ !eq !=:= !=== !eqv etc.
tight and &&
tight or
equal to
cmp <=> leg # lt => -1, eq => 0, gt => +1
~~ # smart match (see smartmatch)
!~~ # negated smart match
In general, any infix compar
sh()
It returns a string that is the English version of the given language or if nothing is given (or an invalid langauage) then it returns the current source language's name.
my $source
if ($format eq "latex"){print $outputFH $latex->endFile};
}
#only work if the text files are given (not only the alignment files).
sub getSize {
my $alSet = shift;
my ($file,$factor);
my $size;
=item * C<=~> becomes the "smart match" operator C<~~>, with a whole new set
of semantics. Anywhere you used C<=~> before you now use C<~~>, but C<~~> is
much more general now. See L<Synopsis 4> for
<=~> >> macro which always fails at
compile time with a message directing the user either to use C<~~> or C<~=> instead,
or to put a space between if they really wanted to assign a stringified value.)
smartmatches the
endpoints in the domain of the object being matched, so C<< 1.5 ~~
1^..^2 >> is true. (But C<< 2.1 ~~ 1..2 >> is false.)
=item * The unary C<^> operator generates a range from C<0>
C<when> statement, because:
when $is_sheep { push @sheep, $_ }
is equivalent to:
if $_ ~~ $is_sheep { push @sheep, $_; next }
When C<$is_sheep> is a subroutine reference, that implicit sm
my $context = want;
if $context ~~ List {
my @values = block();
return { *@values };
}
elsif $context ~~ Scalar {
my $value = block();
|
|-----------------------------------|
| ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |~~
$comments,
===================================
.
write STDOUT;
in Perl 6 we
har><1,$width>) /;
# Squeeze the resultant substring...
(my $result = $1) ~~ s:each/ <$ws> | \v+ /\c[SPACE]/;
# Check for any more data still to come...
r:
sub expurgate (Str *@hidewords) {
return sub (Str $data is rw) {
$data ~~ s:ei/(@hidewords)/$( 'X' x length $1 )/;
return $data;
}
}
We could then
readme.txt' => 'README',
);
my @Tempfiles = qw(
pod2htmd.tmp
pod2htmd.x~~
pod2htmi.tmp
pod2htmi.x~~
);
use strict;
use File::Copy;
local $/;
foreach my $target (keys %TEXT) {
Pipe::open("$PIL $optional_args $tempfilename");
my $pilresult = $pilfh.readline();
$pilresult ~~ s:P5/\r//;
$pilfh.close();
unlink($tempfilename);
return $pilresult;
}
$Test::Pil::Descript
use v6-alpha;
#package PIL2;
my $debug_traverse = 0;
# tokenizer
sub tokenize ( $s ) {
$s ~~ m:g:perl5 {(\"(?:\\\\|\\"|.)*?\"|[\:\,\=\{\(\[\}\)\]]|\w+)}; #"
}
# JSON parser - creates an A
uoted string
\, | \= | \{ | \( | \[ | \} | \) | \] | \w+
)
};
my @b = $pil2 ~~ $tokens;
my $tabs = 1;
my $tab = ' ';
for @b {
if $_ eq ',' {
print $_, "\n", $tab
% 26];
@.table[@lower[$_]] = @lower[($_ + $shift) % 26];
}
}
if $mode ~~ m:P5:i/^de/ {
my @tt;
for @.table.kv { @tt[$^value] = $^key }
@.table = @t
from an iso date
multi sub date( Str $iso8601 ) returns Date::Gregorian is export {
$iso8601 ~~ $iso8601_re_anchored
or die "can't match '$iso8601' to available ISO-8601 formats";
m
ch
Number The numeric value of the matched string (i.e. given
"foo123bar"~~/\d+/, then $/ in numeric context will be 123)
Boolean True if success, false otherwise
=h
mit> and <cut> (see below).
=head2 Modifiers
Used as adverbial modifiers:
"foO bar" ~~ m:s:ignorecase:g/[o | r] ./
and can appear within rules
sub rule { <foo> [:i <ba
"This should never happen"}
default {
my @index = split('',$didget);
@index = grep {$_ ~~ /^<[A..Za..z0..9+\/=]>+$/},@index;
[~] map {chr ($_)}, decode(@index)}
}
}
# 1716151
use v6-alpha;
say "1..1";
my $str = 'abcbcaddd';
$str ~~ s:P5:g/bc/oz/;
if $str eq 'aozozaddd' { say "ok 1" } else { say "not ok 1" }
1;
rules, Captures are superclasses of Match. So in the example of:
my $rv = ("x-y-z-moose" ~~ /(.)-(.)-(.)-<animal> :{ return give_birth(|$/) })
C<give_birth()> gets called with 'x', 'y', and
l elements
given $x { ... } # $x is now topic for block
when EXPR { ... } # perform $_ ~~ EXPR execute block and break
default { ... } # same as when true { ... }
=head2 Closur
= %*ENV<QUERY_STRING> // %*ENV<REDIRECT_QUERY_STRING>;
if ($.query_string ~~ /<[;&=]>/) {
$.query.parse_params($.query_string);
} else {
;
#my $pil2 = @pil2.join('');
# slurp stdin - xinming++
my $pil2 = ** $*IN.slurp;
my @b = $pil2 ~~ $tokens;
# say "Tokens: ", @b.join('><');
my $ast = parse( << { >>, 'hash', << } >>, @b );
# say $
hc --version`;
%attrs<pugs_revision> = %?CONFIG<pugs_revision>;
%attrs<uname> = chomp `uname -a`;
# Obscure hostname for privacy
%attrs<uname> ~~ s/<after \s+> (\S+)/HOSTOBSCURED/;
say %attrs.yaml;