Skip to content

Instantly share code, notes, and snippets.

belden /
Created December 2, 2013 23:03
Tail recursion pattern in Perl - for some reason people say Perl doesn't have tail recursion; you just need to do a little extra work.
#!/usr/bin/env perl
use strict;
use warnings;
use bigrat;
my $n = shift || 100;
print "$n! = " . tail_factorial($n) . "\n";
draegtun / webapp.psgi
Created November 17, 2010 16:41
Expose any Perl object over the web. An interesting little snippet (using Plack)
View webapp.psgi
#!/usr/bin/env perl
use 5.012;
use warnings;
use autobox::Core;
my $expose = []; # expose an Array object (singleton)
my $app = sub {
my ($func, @attrs) = $_[0]->{PATH_INFO}->split('/')->tail;