diff --git a/src/bindings/perl/Makefile.PL b/src/bindings/perl/Makefile.PL
index 4e457fcd77e2ee230aeccf79080e073d4f6eb493..c9bf9db947a5cd9637de62b816574b7fb0e77009 100644
--- a/src/bindings/perl/Makefile.PL
+++ b/src/bindings/perl/Makefile.PL
@@ -10,6 +10,6 @@ WriteMakefile(
     LIBS => ["-lhammer"],
     OBJECT => 'hammer_wrap.o',
     INC => '-I../..',
-    CCFLAGS => "$Config{ccflags} -DSWIG -std=gnu99",
+    CCFLAGS => "$Config{ccflags} -DSWIG -DHAMMER_INTERNAL__NO_STDARG_H -std=gnu99",
     );
 
diff --git a/src/bindings/perl/hammer.i b/src/bindings/perl/hammer.i
index ff9d7f4ebc7cb71c08f0d17872c42159bd41d628..eaf504d87f1b38c07098a3414a7011952bcbbeda 100644
--- a/src/bindings/perl/hammer.i
+++ b/src/bindings/perl/hammer.i
@@ -1,6 +1,7 @@
 %module hammer;
 %begin %{
 #include <unistd.h>
+#include <stdbool.h>
 #include <stdint.h>
 %}
 
@@ -36,7 +37,7 @@
     SWIG_exception_fail(SWIG_TypeError, "Expected array ref");
 
   AV* av = (AV*) SvRV($input);
-  size_t amax = av_top_index(av) + 1; // I want the length, not the top index...
+  size_t amax = av_len(av) + 1; // I want the length, not the top index...
   // TODO: is this array copied?
   $1 = malloc((amax+1) * sizeof(*$1));
   $1[amax] = NULL;
diff --git a/src/hammer.h b/src/hammer.h
index 22f77f5464efd26087219431c1ee8b29c4c8b410..e536c0b1afc6fa622919a04b3d2e793d52a580d0 100644
--- a/src/hammer.h
+++ b/src/hammer.h
@@ -35,9 +35,7 @@ extern "C" {
 
 #ifndef __cplusplus
 #ifndef HAMMER_INTERNAL__NO_STDARG_H
-#ifndef SWIGPERL
 typedef int bool;
-#endif // SWIGPERL
 #endif // HAMMER_INTERNAL__NO_STDARG_H
 #endif