in reply to Re^2: Need script help
in thread Need script help
++ Thanks for your response.
I only started using PERL5OPT a few weeks ago because I was sick of having to add those pragmata whenever I wanted a quick one-liner.
The "perlrun: PERL5OPT" documentation starts:
"Command-line options (switches). Switches in this variable are treated as if they were on every Perl command line."
I took this to mean that (with my current PERL5OPT settings)
perl -E '...'
would be expanded to
perl -Mstrict -Mwarnings -Mautodie -E '...'
I ran quite a few tests and, when satisfied everything worked OK, modified my .bash_profile so that it would always be available.
It never occurred to me that this would affect scripts; however, following your comments, I've run additional script tests and it does appear that my shebang line
#!/usr/bin/env perl
is being altered to
#!/usr/bin/env perl -Mstrict -Mwarnings -Mautodie
As I always add strict and warnings to every script, and often add autodie, this is not a problem for me. So, while I thank you for alerting me to this, I will continue to use PERL5OPT as I'm currently doing unless I come across a good reason for not doing so.
"It makes your scripts non-portable."
Perhaps you could expand on this. I'm failing to see any portability issues.
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Need script help
by haukex (Archbishop) on Sep 23, 2016 at 07:10 UTC | |
by kcott (Archbishop) on Sep 24, 2016 at 18:25 UTC | |
|
Re^4: Need script help
by Discipulus (Canon) on Sep 23, 2016 at 07:30 UTC | |
by kcott (Archbishop) on Sep 24, 2016 at 18:26 UTC |