in reply to using a module for a portion of the code only

use bigint; is lexically scoped. You can limit what it effects by putting curlies around it.

no bigint; cancels bigint's effects. It is also lexically scoped.

Another way of limiting bigint's effect — turning numerical constants into Math::BigInt objects — is to avoid using bigint completely and create Math::BigInt objects for the appropriate constants manually.

For example, say you're starting with the following:

>perl -MO=Concise,-exec -Mbigint -e"my $big = 1234; for (1..4) { foo($ +big) }" ... 7 <0> pushmark s 8 <$> const[RV \HASH] s <-- for loop indexes are needlessly 9 <$> const[RV \HASH] s <-- BigInt objects. a <#> gv[*_] s b <{> enteriter(next->h last->k redo->c) lKS/8 ...

Let's selectively make $big a BigInt to avoid making the loop indexes objects:

>perl -MO=Concise,-exec -MMath::BigInt -e"my $big = Math::BigInt->new( +'1234'); for (1..4) { foo($big) }" ... b <0> pushmark s c <$> const[IV 1] s <-- Much better d <$> const[IV 4] s <-- e <#> gv[*_] s f <{> enteriter(next->l last->o redo->g) lKS/8 ...