This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my %bar; | |
sub foo { | |
1; | |
} | |
%bar<z> = 'quux'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 IO::Path | |
class IO::Path is Cool does IO::FileTest { } | |
Holds a path of a file or directory. The path is generally divided | |
into three parts, the I<volume>, I<directory> and I<base name>. | |
On Windows, the volume is a drive letter like C<C:>, or a UNC network volume | |
like C<\\share\>. On UNIX-based systems, the volume part is empty. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
method baz ($a, $b?) { | |
if ! defined $b || $b eq '' { | |
$b = $*CWD; | |
} | |
say $a, $b; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my role IO::FileTestable { } | |
my class IO::Handle does IO::FileTestable { } | |
class IO is IO::Handle { ; } | |
my class IO::Path is Cool does IO::FileTestable { | |
#also does IO::FileTestable; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
print $("reHTona tsuj".flip.tclc, Mu.^methods.grep(/p.**2l$/).tclc, "hacker\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
use Lingua::Number; | |
my &to_roman = &roman-numeral; | |
use Test; | |
is to_roman(3), "III", "3 gets converted to III"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
sub uq(*@vals) { so @vals.bag.values.all == 1 } | |
sub rowN($n, *@vals) { | |
return say "[{@vals.join(',')}]" if $n > 8; | |
for 1..8 -> $new { | |
my @vnew = @vals, $new; | |
my ($i1, $i2) = 0, 0; | |
next if !uq(@vnew) | |
or !uq(@vnew.map: { $_ - ++$i1 }) | |
or !uq(@vnew.map: { $_ + ++$i2 }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program 1 | |
perl6 -n -e '.split(" ")[2].say' 1.txt | |
program 2 | |
perl6 -e 'say [+] $*ARGFILES.lines' 2.txt | |
program 3 | |
perl6 -n -e 'say $_, "\n"' 3.txt | |
program 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use 5.10.0; | |
use strict; | |
use warnings; | |
my $MAX_LINES = 100_000; | |
my @FIELDS = (7, 8, 9, 14, 17, 18, 19, 25, 30, 31, 35, 36, 37, 43, 44, 46, 47, 50, 52, 55, 62, 63, 66, 67, 68, 75, 76, 77, 81); | |
sub nextfilename { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use 5.10.0; | |
use strict; | |
use warnings; | |
use Tie::File; | |
my $MAX_LINES = 100_000; | |
my @FIELDS = (7, 8, 9, 14, 17, 18, 19, 25, 30, 31, 35, 36, 37, 43, 44, 46, 47, 50, 52, 55, 62, 63, 66, 67, 68, 75, 76, 77, 81); |
OlderNewer