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


In reply to Re: Why do I need 'use 5.010;' ahen I am running '5.24' by kcott
in thread Why do I need 'use 5.010;' ahen I am running '5.24' by jason.jackal

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.