On Fri, Jun 17, 2011 at 08:14, Marek Stepanek <marekstepa...@yahoo.co.uk> wrote:
snip
> #!/usr/bin/perl
snip
> And yes, yes, perlbrew activated the right perl:
>
> perl -v
>
> This is perl 5, version 14, subversion 0 (v5.14.0) built for darwin-2level
snip

Take another look at the shebang line.  You are asking for the version
of perl installed in /usr/bin.  This is the system version of perl
(which is why you are getting 5.10).  Your scripts need to start with
one of the following paths:

#!/home/USERNAME/perl5/perlbrew/perls/perl-5.14.0/bin/perl

or

#!/usr/bin/env perl

The benefit of the first is that it will always use that version of
perl, the downside is the same (e.g. when you upgrade to Perl 5.14.1
it will still use 5.14.0).  The benefit of the second is that uses the
first perl it finds in your PATH, the downsides are that you have to
have your PATH setup correctly (for instance, cron jobs don't tend
have proper environments) and you always get the version in the PATH
(if you have multiple versions of perl that each are doing different
things, this might not be the best solution).

A third option is to always use the perl interpreter in the commandline:

perl foo.pl

The shebang line is not used to find the perl interpreter in that case
(but I believe some of the switches still have an effect).  This is
the solution I tend to use these days.


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

Reply via email to