in reply to Why do I need 'use 5.010;' ahen I am running '5.24'

G'day jason.jackal,

If you're using Perl from the command line, you can use the -E switch to get all the features of your current version of Perl. See -E commandline in perlrun.

I'm using 5.26.0. Here's an example with 'say':

$ perl -e 'say "fred"' String found where operator expected at -e line 1, near "say "fred"" (Do you need to predeclare say?) syntax error at -e line 1, near "say "fred"" Execution of -e aborted due to compilation errors. $ perl -E 'say "fred"' fred

Using a much newer feature (see "perlref: Postfix Dereference Syntax"):

$ perl -e 'my $x = [qw{a b c}]; print "$x->@*\n"' ARRAY(0x7f82b20040b0)->@* $ perl -E 'my $x = [qw{a b c}]; print "$x->@*\n"' a b c

Now, if I switch my Perl version to 5.14.0 (long before that feature was available; and no other special significance beyond it being the earliest version I currently have available):

$ perlbrew switch perl-5.14.0t $ perl -E 'my $x = [qw{a b c}]; print "$x->@*\n"' ARRAY(0x7fe830004ae8)->@*

Without that feature being available in 5.14.0, '-E' works the same as '-e' in 5.26.0 (with respect to that specific feature). Other features, that were available in 5.14.0, still work as expected:

$ perlbrew switch perl-5.14.0t $ perl -E 'say "fred"' fred

— Ken