in reply to Perl/UNIX .profile problem

Personally, I vote for insensate's solution (I ++'d a few other replies for intrinsic value, but he has the approach I would use).

Note that in addition to the sub-shell versus perl environment issue cited by many folks above, there is yet another barrier that keeps your original script from working the way you want:

Any statements within your script that modify %ENV will take effect at run-time. Meanwhile, perl will attempt to handle the "use sectran" directive at compile-time. Changes to %ENV within the script will come too late to have the intended effect, and this is another reason why insensate has the right approach, IMO.

update: Seeing elwarren's remark about using the BEGIN block to set %ENV, I believe that even this won't get the %ENV settings done soon enough to help with "use". At least, when I tried something like this:

BEGIN { $ENV{PERL5LIB} = "/some/special/lib" } use SpecialModule; # (a .pm file in /some/special/lib) ...
it didn't work -- I got a report about "Can't locate SpecialModule.pm...". It would only work when I set PERL5LIB in the shell environment, and then ran the script in that shell (and then the BEGIN block is not needed, of course).