http://qs1969.pair.com?node_id=11155650


in reply to Re^2: how to import::into v5.020
in thread how to import::into v5.020

Not quite.

use v5.20;

is closer to

BEGIN { require v5.20; } no feature qw( :all ); # `use v5.10;`+ use feature qw( :5.20 ); # `use v5.10;`+ use strict; # `use v5.12;`+ #use warnings; # `use v5.35;`+

So you want

require v5.20; feature->unimport::out_of( $caller, ':all' ); # `use v5.10;`+ feature->import::into( $caller, ':5.20' ); # `use v5.10;`+ strict->import::into( $caller ); # `use v5.12;`+ #warnings->import::into( $caller ); # `use v5.35;`+

Turning off all features first is especially important with 5.35+ because use v5.35; and higher turn off features which are enabled by default. Specifically,

$ perl -e'use v5.35; abc def;' Bareword found where operator expected (Do you need to predeclare "abc +"?) at -e line 1, near "abc def" syntax error at -e line 1, near "abc def" Execution of -e aborted due to compilation errors. $ perl -e'use feature qw( :5.35 ); abc def;' Can't locate object method "abc" via package "def" (perhaps you forgot + to load "def"?) at -e line 1. $ perl -e'no feature qw( :all ); use feature qw( :5.35 ); abc def;' Bareword found where operator expected (Do you need to predeclare "abc +"?) at -e line 1, near "abc def" syntax error at -e line 1, near "abc def" Execution of -e aborted due to compilation errors.