Mailinglist Archive: opensuse (4053 mails)

< Previous Next >
Re: [SLE] How to upgrade to Perl 5.6.1 from
> Thank you for the useful tip. I was interested to read your comment
> about using "env" to run your Perl scripts. I have recently started
> having problems with running my perl progs with errors like "No such
> file or directory" even when using the fully qualified path to the
> program. The program runs fine with "perl filename". I suspect your
> "env" trick is the answer - more details please.

Replace your she-bang line:



#!/usr/bin/env perl

It's detailed in the "perlrun" perldoc page. I have scripts which I want to
run unaltered on Linux and AIX (where the Perl binaries live in totally
weird places). This is how I do it.

The only disadvantage is that this doesn't work:

#!/usr/bin/env perl -w

The -w switch makes env barf. If you want warnings (which, of course, you do)
you have to use this:

#!/usr/bin/env perl
use diagnostics;
disable diagnostics;

which has a similar affect. In Perl 5.6 and onwards you can just say "use
warnings" which does exactly what -w does, but will only work if you know the
Perl version is 5.6 or later.

< Previous Next >