Index: BOOK/final-system/mips64-chapter.xml
===================================================================
--- BOOK/final-system/mips64-chapter.xml	(revision b65bb044eebe9e66c7e27d4af1fddf4ecbd9071c)
+++ BOOK/final-system/mips64-chapter.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -38,4 +38,6 @@
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/libtool-n32.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/libtool-64bit.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/perl.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/perl-n32.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/perl-64bit.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/readline.xml"/>
Index: BOOK/final-system/multilib/perl-64bit.xml
===================================================================
--- BOOK/final-system/multilib/perl-64bit.xml	(revision b65bb044eebe9e66c7e27d4af1fddf4ecbd9071c)
+++ BOOK/final-system/multilib/perl-64bit.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -9,5 +9,5 @@
   <?dbhtml filename="perl-64bit.html"?>
 
-  <title>Perl-&perl-version;</title>
+  <title>Perl-&perl-version; 64 Bit</title>
 
   <indexterm zone="ch-system-perl">
@@ -22,13 +22,4 @@
     <title>Installation of Perl</title>
 
-    <para os="m1">In multilib builds we install compilers and libraries for each available
-    architecture.  The description below says that perl installs several hundred
-    libraries, but they are used by invoking <command>perl</command>, not by linking
-    to them with <command>ld</command>.  Although it is possible to install perl for
-    32 bits, move it to a different name, and then install the 64-bit version, it is
-    almost always invoked as just <command>perl</command>. That means only the
-    libraries and modules for the last version installed will be accessible. We
-    therefore only install one version.</para>
-
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
     href="../common/perl.xml"
@@ -40,14 +31,14 @@
 
     <para os="p3">Perl does not, by default, know about library directories with names other
-    than lib, such as lib64.  The following patch will allow it to install to lib64:</para>
+    than lib, The following patch will allow it to install to other directories:</para>
 
 <screen os="p4"><userinput>patch -Np1 -i ../&perl-multilib-patch;</userinput></screen>
 
-    <para os="p5">There is a further (possibly cosmetic) anomaly - if we install perl and
+    <para os="s1">There is a further (possibly cosmetic) anomaly - if we install perl and
     then run <command>perl -V</command> it will claim that libc is in /lib.  The
-    following patch fixes this, but only takes effect when <command>make install
+    following sed fixes this, but only takes effect when <command>make install
     </command> is run:</para>
 
-<screen os="p6"><userinput>patch -Np1 -i ../&perl-lib64-patch;</userinput></screen>
+<screen os="s2"><userinput>sed -i "/libc/s@/lib@/lib64@" hints/linux.sh</userinput></screen>
 
     <para os="m2">We still need to tell perl to actually use lib64:</para>
@@ -119,4 +110,49 @@
     xpointer="xpointer(//*[@os='k'])"/>
 
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="perl.xml"
+    xpointer="xpointer(//*[@os='l'])"/>
+
+<screen os="m"><userinput>mv /usr/bin/perl{,-64}</userinput></screen>
+
+    <para os="n">Now we need to create a multilib wrapper that lets us choose
+    which perl installation to use.</para>
+
+<screen os="o"><userinput>cat &gt; perl_wrapper.c &lt;&lt; "EOF"
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;string.h&gt;
+#include &lt;unistd.h&gt;
+#include &lt;errno.h&gt;
+
+int main (int argc, char *argv[])
+{
+  char *perl_arch;
+  if ((perl_arch = getenv("PERL_ARCH")) == NULL)
+    perl_arch = "64";
+
+  char *filename = malloc(strlen(argv[0]) + strlen(perl_arch) + 2);
+  strcpy(filename, argv[0]);
+  strcat(filename, "-");
+  strcat(filename, perl_arch);
+
+  int ret = 0;
+  ret = execvp(filename, argv);
+  if ((ret != 0)&amp;&amp;(errno != 0))
+  {
+    char *errmsg = malloc(strlen(filename) + 19);
+    strcpy(errmsg, "Unable to execute ");
+    strcat(errmsg, filename);
+    perror(errmsg);
+    free(errmsg);
+  }
+
+  free(filename);
+
+  return ret;
+}
+EOF
+gcc ${BUILD64} perl_wrapper.c -o /usr/bin/perl</userinput></screen>
+
   </sect2>
 
Index: BOOK/final-system/multilib/perl-n32.xml
===================================================================
--- BOOK/final-system/multilib/perl-n32.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
+++ BOOK/final-system/multilib/perl-n32.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-system-perl-n32" role="wrap">
+  <?dbhtml filename="perl-n32.html"?>
+
+  <title>Perl-&perl-version; N32 Libraries</title>
+
+  <indexterm zone="ch-system-perl-n32">
+    <primary sortas="a-Perl">Perl</primary>
+    <secondary>N32</secondary>
+  </indexterm>
+
+  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+  href="../common/perl.xml"
+  xpointer="xpointer(//*[@role='package'])"/>
+
+  <sect2 role="installation">
+    <title>Installation of Perl</title>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='p1'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='p2'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="perl-64bit.xml"
+    xpointer="xpointer(//*[@os='p3'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="perl-64bit.xml"
+    xpointer="xpointer(//*[@os='p4'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="perl-64bit.xml"
+    xpointer="xpointer(//*[@os='s1'])"/>
+
+<screen os="s2"><userinput>sed -i "/libc/s@/lib@/lib32@" hints/linux.sh</userinput></screen>
+
+    <para os="m2">We still need to tell perl to actually use lib32:</para>
+
+<screen os="m3"><userinput>echo 'installstyle="lib32/perl5"' >>hints/linux.sh</userinput></screen>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='a00'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='a01'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='a'])"/>
+
+<screen os="b"><userinput>./configure.gnu --prefix=/usr \
+   -Dman1dir=/usr/share/man/man1 \
+   -Dman3dir=/usr/share/man/man3 \
+   -Dpager="/bin/less -isR" \
+   -Dlibpth="/usr/local/lib32 /lib32 /usr/lib32" \
+   -Dcc="gcc ${BUILDN32}" \
+   -Dusethreads</userinput></screen>
+
+    <variablelist os="m4">
+      <title>The meaning of the new configure option:</title>
+
+      <varlistentry>
+        <term><parameter>-Dlibpth="/usr/local/lib32 /lib32 /usr/lib32"</parameter></term>
+        <listitem>
+          <para>This tells Perl to link against the N32 libraries.</para>
+        </listitem>
+      </varlistentry>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='c1'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='c2'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='c3'])"/>
+
+    </variablelist>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='d'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='e'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='h'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='j'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='k'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="perl.xml"
+    xpointer="xpointer(//*[@os='l'])"/>
+
+<screen os="m"><userinput>mv /usr/bin/perl{,-n32}</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in <xref
+    linkend="contents-perl" role="."/></para>
+
+  </sect2>
+
+</sect1>
Index: BOOK/final-system/multilib/perl.xml
===================================================================
--- BOOK/final-system/multilib/perl.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
+++ BOOK/final-system/multilib/perl.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-system-perl-32" role="wrap">
+  <?dbhtml filename="perl.html"?>
+
+  <title>Perl-&perl-version; 32 Bit Libraries</title>
+
+  <indexterm zone="ch-system-perl-32">
+    <primary sortas="a-Perl">Perl</primary>
+    <secondary>32 Bit</secondary>
+  </indexterm>
+
+  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+  href="../common/perl.xml"
+  xpointer="xpointer(//*[@role='package'])"/>
+
+  <sect2 role="installation">
+    <title>Installation of Perl</title>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='p1'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='p2'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='a00'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='a01'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='a'])"/>
+
+<screen os="b"><userinput>./configure.gnu --prefix=/usr \
+   -Dman1dir=/usr/share/man/man1 \
+   -Dman3dir=/usr/share/man/man3 \
+   -Dpager="/bin/less -isR" \
+   -Dcc="gcc ${BUILD32}" \
+   -Dusethreads</userinput></screen>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='c'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='d'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='e'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='h'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='j'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/perl.xml"
+    xpointer="xpointer(//*[@os='k'])"/>
+
+    <para os="l">Add a suffix to the perl binary which the multilib wrapper
+    installed later will take advantage of.</para>
+
+<screen os="m"><userinput>mv /usr/bin/perl{,-32}</userinput></screen>
+
+  </sect2>
+
+  <sect2 role="content">
+    <title/>
+
+    <para>Details on this package are located in <xref
+    linkend="contents-perl" role="."/></para>
+
+  </sect2>
+</sect1>
Index: BOOK/final-system/ppc64-chapter.xml
===================================================================
--- BOOK/final-system/ppc64-chapter.xml	(revision b65bb044eebe9e66c7e27d4af1fddf4ecbd9071c)
+++ BOOK/final-system/ppc64-chapter.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -34,4 +34,5 @@
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="ppc64/libtool.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/libtool-64bit.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/perl.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/perl-64bit.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/readline.xml"/>
Index: BOOK/final-system/sparc64-chapter.xml
===================================================================
--- BOOK/final-system/sparc64-chapter.xml	(revision b65bb044eebe9e66c7e27d4af1fddf4ecbd9071c)
+++ BOOK/final-system/sparc64-chapter.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -34,4 +34,5 @@
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="sparc64/libtool.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/libtool-64bit.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/perl.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/perl-64bit.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/readline.xml"/>
Index: BOOK/final-system/x86_64-chapter.xml
===================================================================
--- BOOK/final-system/x86_64-chapter.xml	(revision b65bb044eebe9e66c7e27d4af1fddf4ecbd9071c)
+++ BOOK/final-system/x86_64-chapter.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -34,4 +34,5 @@
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="x86_64/libtool.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/libtool-64bit.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/perl.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/perl-64bit.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="multilib/readline.xml"/>
Index: BOOK/introduction/common/changelog.xml
===================================================================
--- BOOK/introduction/common/changelog.xml	(revision b65bb044eebe9e66c7e27d4af1fddf4ecbd9071c)
+++ BOOK/introduction/common/changelog.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -41,4 +41,9 @@
       <itemizedlist>
         <listitem>
+          <para>[jciccone] - Added a multilib perl setup that has a multilib
+          wrapper. The multilib wrapper checks for the value of PERL_ARCH and
+          executes the cooresponding perl binary.</para>
+        </listitem>
+        <listitem>
           <para>[ken] - Remove include/net from instructions for headers.</para>
         </listitem>
Index: BOOK/materials/mips64/patches.xml
===================================================================
--- BOOK/materials/mips64/patches.xml	(revision b65bb044eebe9e66c7e27d4af1fddf4ecbd9071c)
+++ BOOK/materials/mips64/patches.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -69,8 +69,4 @@
     xpointer="xpointer(//*[@os='perl-multilib-patch'])"/>
 
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
-    href="../x86_64/patches.xml"
-    xpointer="xpointer(//*[@os='perl-lib64-patch'])"/>
-
     <varlistentry os="util-linux-mips64-patch">
       <term>Util-linux MIPS64 Patch - <token>&util-linux-mips64-patch-size;</token>:</term>
Index: BOOK/materials/ppc64/patches.xml
===================================================================
--- BOOK/materials/ppc64/patches.xml	(revision b65bb044eebe9e66c7e27d4af1fddf4ecbd9071c)
+++ BOOK/materials/ppc64/patches.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -56,8 +56,4 @@
     xpointer="xpointer(//*[@os='perl-multilib-patch'])"/>
 
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
-    href="../x86_64/patches.xml"
-    xpointer="xpointer(//*[@os='perl-lib64-patch'])"/>
-
     <varlistentry>
       <term>Powerpc-utils Fixes Patch - <token>&powerpcutils64-patch-size;</token>:</term>
Index: BOOK/materials/sparc64/patches.xml
===================================================================
--- BOOK/materials/sparc64/patches.xml	(revision b65bb044eebe9e66c7e27d4af1fddf4ecbd9071c)
+++ BOOK/materials/sparc64/patches.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -38,8 +38,4 @@
 
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
-    href="../x86_64/patches.xml"
-    xpointer="xpointer(//*[@os='perl-lib64-patch'])"/>
-
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
     href="../sparc/patches.xml"
     xpointer="xpointer(//*[@os='silo-fixes-patch'])"/>
Index: BOOK/materials/x86_64/patches.xml
===================================================================
--- BOOK/materials/x86_64/patches.xml	(revision b65bb044eebe9e66c7e27d4af1fddf4ecbd9071c)
+++ BOOK/materials/x86_64/patches.xml	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -52,13 +52,4 @@
     </varlistentry>
 
-    <varlistentry os="perl-lib64-patch">
-      <term>Perl Libc lib64 Patch - <token>&perl-lib64-patch-size;</token>:</term>
-      <listitem>
-        <para>Download: <ulink
-        url="&patches-root;&perl-lib64-patch;"/></para>
-        <para>MD5 sum: <literal>&perl-lib64-patch-md5;</literal></para>
-      </listitem>
-    </varlistentry>
-
   </variablelist>
 
Index: BOOK/patches.ent
===================================================================
--- BOOK/patches.ent	(revision b65bb044eebe9e66c7e27d4af1fddf4ecbd9071c)
+++ BOOK/patches.ent	(revision 9c1db810c432121dc70313606b640d599551cc93)
@@ -151,8 +151,4 @@
 <!ENTITY perl-multilib-patch-size "1.4 KB">
 
-<!ENTITY perl-lib64-patch "perl-&perl-version;-libc_lib64-1.patch">
-<!ENTITY perl-lib64-patch-md5 "c503928cad589ba5211c0b3f999a37bd">
-<!ENTITY perl-lib64-patch-size "1 KB">
-
 <!-- Start of Pure64 patches -->
 
