diff --git a/highlight/extras/swig/makefile b/highlight/extras/swig/makefile
index 1e9a0b2..e187e59 100644
--- a/highlight/extras/swig/makefile
+++ b/highlight/extras/swig/makefile
@@ -9,6 +9,7 @@ LUA_CFLAGS=$(shell pkg-config --cflags lua)
 LUA_LIBS=$(shell pkg-config --libs lua)
 PYTHON_CFLAGS=$(shell pkg-config --cflags python-2.7)
 PERL_INC=$(shell perl -MExtUtils::Embed -eccopts)
+PERL_LIBS=$(shell perl -MExtUtils::Embed -eldopts)
 PHP_INC=$(shell php-config --includes)
 
 lib-stamp:
@@ -29,7 +30,7 @@ perl: lib-stamp
 php: lib-stamp
 	swig -c++ -php -o highlight_wrap.cpp highlight.i
 	${CXX} ${CFLAGS} -c highlight_wrap.cpp ${LUA_CFLAGS} ${PHP_INC} -I${HL_INC}
-	${CXX} -shared -s highlight_wrap.o -L${HL_SRC} -lhighlight ${LUA_LIBS} -o highlight.so
+	${CXX} -shared -s highlight_wrap.o -L${HL_SRC} -lhighlight ${LUA_LIBS} ${PERL_LIBS} -o highlight.so
 
 clean: python-clean perl-clean php-clean
 	rm -f *-stamp