1

Ubuntu 14 came with perl v5.18.2, but I would like to test my program with perl v5.22.0 which is installed through perlbrew and then perlbrew switch perl-5.22.0 to use the version I want.

After switch to perl v5.22.0, I have tried to test my program with sudo but why it is executed in default perl v5.18.2?

perl -v: result enter image description here

sudo perl -v : result enter image description here

s_m
  • 129
  • 8
  • 2
    Can you report the output of `which perl` and `sudo which perl`? – Sebastian Redl Oct 14 '15 at 09:03
  • http://gugod.org/2010/12/a-shared-perlbrew-root-for-multiple-users/ – mpapec Oct 14 '15 at 09:04
  • @SebastianRedl `which perl` results `/home/xxxx/perl5/perlbrew/perls/perl-5.22.0/bin/perl` and `sudo which perl` is `/usr/bin/perl`. How can I force to use `perl v5.22.0` for both `perl` and `sudo perl`? – s_m Oct 14 '15 at 09:10
  • You want: `sudo \`which perl\` -v` – ikegami Oct 14 '15 at 18:19
  • @s_m The easiest way to do that is to not rely on 'perl' as a command-line alias for /usr/bin/perl (or anything else) and use absolute paths. So do `sudo /home/xxx/....../bin/perl -v` and it won't look in root's path for which version of perl to use, it will use the version you explicitly specified, using it's absolute path. – doomsday Oct 14 '15 at 20:47

0 Answers0