Skip to content

Instantly share code, notes, and snippets.

View cowens's full-sized avatar

Chas. J. Owens IV cowens

  • Martinsburg, WV
View GitHub Profile
#!/usr/bin/perl
use strict;
use warnings;
use subs qw/system/;
sub system {
return Fix::System->new(CORE::system @_);
}
package Unicode::Digits;
use Exporter 'import';
our @EXPORT = qw(digits_to_int);
my %h;
@h{0x00000030 .. 0x00000039} = (0 .. 9);
@h{0x00000660 .. 0x00000669} = (0 .. 9);
@h{0x000006f0 .. 0x000006f9} = (0 .. 9);
@h{0x000007c0 .. 0x000007c9} = (0 .. 9);
#!/usr/bin/perl
use strict;
use warnings;
my @results = (0, 1, 0, 0, 1);
my $i = 0;
my %h;
for my $key (qw/a a b c b/) {
#!/usr/bin/perl
use strict;
use warnings;
use Benchmark;
sub list {
return scalar @_;
}
#!/usr/bin/perl
use strict;
use warnings;
use Term::ReadKey;
use Time::HiRes qw/usleep/;
ReadMode 4;
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
my $s = "";
for my $s (qw/ ab ba /) {
my @match = $s =~ /(a)(b)|(b)(a)/;
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
my $year = qr{
(?<year>
(?<century> 1 [6-9]) (?<decade>[0-9]{2}) |
(?<century> [2-9] [0-9]) (?<decade> [0-9]{2})
#!/usr/bin/perl
END { print "$string\n" }
BEGIN { $string = "w" }
CHECK { $string .= "e" }
INIT { $string .= "n" }
CHECK { $string .= "d" }
END { $string .= "t" }
CHECK { $string .= "k" }
BEGIN { $string .= "o" }
#!/usr/bin/perl
use perl5i;
BEGIN { say 1 }
BEGIN { say 2 }
CHECK { say 4 }
CHECK { say 3 }
@cowens
cowens / timeout.pl
Created July 14, 2009 04:46
A function to handle timing out
#!/usr/bin/perl
use strict;
use warnings;
sub timeout {
my ($wait, $code, $timedout, $error) = (@_,
sub { warn $@ }, sub { die $@ });
eval {