How I should install 32-bit Perl on 64-bit machine without affecting the existing applications that uses 64-bit Perl? Is it possible to have a single application (Read: Single file) use different version of Perl for different tasks?
Install the custom perl in a different directory, say /opt/perl-5.10.1-32bit
and specify that path in the scripts which you want to use this custom version:
#!/opt/perl-5.10.1-32bit/perl
as the first line of your script.
For example, just a few minutes ago, I did:
$ ./configure -Dprefix=/opt/perl-5.11.0
You might also be interested in perlbrew by Kang-min Liu. It allows you to easily install multiple versions of perl.
After downloading it and installing it, run
perlbrew -h
to see the options. Looking at the documentation, it seems to be able to use the -D options as Sinan and Mark mentioned.
You can't use two versions of perl for a running program for what should be fairly obvious reasons. Without knowing why you want to do that, here are a few ideas:
If you need 64 bit precision but also need to link with 32 bit libraries #1 might help. #2 is obviously a more general solution but potentially harder and/or slower since the communication point could be a bottleneck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With