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/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 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 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 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 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 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 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 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 => ( |
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/env perl | |
# | |
# This is a pre-compiled source code for the cpanm (cpanminus) program. | |
# For more details about how to install cpanm, go to the following URL: | |
# | |
# https://github.com/miyagawa/cpanminus | |
# | |
# Quickstart: Run the following command and it will install itself for | |
# you. You might want to run it as a root with sudo if you want to install | |
# to places like /usr/local/bin. |
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/env perl | |
use strict; | |
use warnings; | |
use Perl::Tidy; | |
exit Perl::Tidy::perltidy( | |
perltidyrc => \( do { local $/ = <DATA> } ), | |
prefilter => sub { | |
no warnings; |
NewerOlder