cLive ;-) has asked for the wisdom of the Perl Monks concerning the following question:

Hmmm, perplexed.

I am trying to work on someone's machine. They have Perl 4 and 5 installed, with 4 as the 'default' (don't ask).

If at the shell, I type:

perl -v

I get

This is perl, version 4.0

However, if I type:

perl -e "print $]"

I get:

5.0040399999999998215

wtf? Can anyone explain this?

cLive ;-)

Replies are listed 'Best First'.
Re: perl 4/5 version issues
by VSarkiss (Monsignor) on Jun 15, 2001 at 03:28 UTC
    Very odd indeed. What shell are you using? Is it interpolating the $] before it gets to Perl? Something to try: does using single quotes make a difference: perl -e 'print $]' Also, does the shell you're using support whence perl so you can see if some "intermediate" script is getting in the way?

    If you find out what it is, I'd be terribly curious to find out.

      Single quotes prints the same.

      whence doesn't work, whereis perl shows path to Perl4.

      Strange one, eh...

      cLive ;-)

        Have you tried typing in the full path to perl for your test? /usr/bin/perl4 -e "print $]"
        I think I'll have to hunt down to make sure Perl4 behaved in the way you expect it to.

        Update:
        Ah ha. This has part of the answer:
        Why am I getting long decimals?
        Now I just need to find out why 5...