This file contains hidden or 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 5.012; | |
| use Benchmark qw( cmpthese timethese ); | |
| use Test::Deep::NoTest; | |
| use Scalar::Util qw(looks_like_number); | |
| use Params::Validate qw(SCALAR HASHREF ARRAYREF); | |
| my @SIG = ( | |
| { type => SCALAR, callbacks => { looks_like_number => sub { looks_like_number($_[0]) } } }, | |
| { type => HASHREF }, |
This file contains hidden or 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/env perl | |
| use strict; | |
| use warnings; | |
| use Benchmark; | |
| use List::Util 'any'; | |
| use match::simple::XS; | |
| use match::simple qw(match); | |
| my $count = shift || 2_000_000; |
This file contains hidden or 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 strict; | |
| use warnings; | |
| { | |
| local $\ = "\n"; # output record separator | |
| local $| = 1; # autoflush | |
| print "Hello"; | |
| print "World"; | |
| } |
This file contains hidden or 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
| sub import { | |
| shift; | |
| @_ = 'with' unless @_; | |
| Keyword::Simple::define $_, \&__rewrite_with for @_; | |
| } | |
| sub unimport { | |
| shift; | |
| @_ = 'with' unless @_; | |
| Keyword::Simple::undefine $_ for @_; |
This file contains hidden or 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 v5.16; | |
| use HTTP::Tiny; | |
| use JSON::PP 'decode_json'; | |
| my ( $lat, $lon ) = ( 54.5, -1.55 ); | |
| my $url = sprintf( | |
| 'https://api.open-meteo.com/v1/forecast?latitude=%s&longitude=%s'. | |
| '&daily=temperature_2m_max,temperature_2m_min&timezone=Europe/London', | |
| $lat, | |
| $lon, |
This file contains hidden or 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
| package MySim; | |
| use Zydeco; | |
| use List::Util qw( shuffle sample ); | |
| # Next line shouldn't be needed, but I guess a bug somewhere in Zydeco... | |
| BEGIN { package MySim::Types; use Type::Library -base; } | |
| class Door { | |
| param prize ( type => Bool, default => false, is => ro ); |
This file contains hidden or 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 v5.40; | |
| use Local::Animal; | |
| sub default_species :scalar { | |
| return "Guinea Pig"; | |
| } | |
| my $geoffrey = Local::Animal->new( | |
| name => "Geoffrey", |
This file contains hidden or 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/env perl | |
| use v5.14; | |
| use Ask qw( error warning info question ); | |
| use Crypt::Cipher::Blowfish qw(); | |
| use Crypt::Mode::CBC qw(); | |
| use Crypt::PK::DSA qw(); | |
| use Getopt::Long qw(GetOptions); | |
| use MIME::Base64::URLSafe qw(urlsafe_b64encode urlsafe_b64decode); | |
| use Path::Tiny qw(path); |
This file contains hidden or 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
| #!perl | |
| use strict; | |
| use warnings; | |
| use constant { | |
| THOUSAND => 1_000, | |
| MILLION => 1_000_000, | |
| BILLION => 1_000_000_000, | |
| }; |
This file contains hidden or 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/env perl | |
| use v5.16; | |
| use warnings; | |
| package ColourSet { | |
| use Moo; | |
| use Types::Standard -types; | |
| has initial => ( |
NewerOlder