in reply to use version confusion

To the best of my knowledge, use v5.10.1 merely indicates to perl that you'd like to enable all features that exist in v5.10.1 and that your script is not expected to run on older perl versions, or conform to their restrictions and limitations. It cannot be used to "downgrade" a newer perl version to an older one by emulating the old version's behavior.

It is possible to use $^V (aka $PERL_VERSION if you use English;) to check the version of perl you're running on and use different code for different versions, but this is of debatable utility. If you need your code to run on older perl versions, it's best to just stick to constructs they allowed and not use newer features.

Replies are listed 'Best First'.
Re^2: use version confusion
by 1s44c (Scribe) on Jul 06, 2014 at 12:35 UTC
    Is there any way to downgrade a recent Perl to an older one? Or do I just have to be really careful not to use features that don't exist on older versions?

      Test your code at least on the minimum and maximum version of Perl you want to support (and if you want to be thorough, the ones in between too).

      You can easily have different Perl versions installed on your system. See for example perlbrew.

      If by "downgrade" you mean by some kind of option to make a newer Perl behave like an older one, then no, at least not completely: While you can disable features, that won't disable all of the things that the newer Perl supports. Only actually using the older Perl version will give you reliable test results.

      None that I'm aware of (though I'm hardly the most experienced monk in the Monastery, so maybe one of the senior brothers will enlighten me). You'll just have to be careful.
      Just look for deprecation warnings. Perl is excellent at backward compatibility, but if a feature is marked "experimental" or deprecation warnings start appearing, then you might want to pay good attention and refactor your code that relies on these.

      You can also always, test against blead.

      PerlBrew.