adefaria has asked for the wisdom of the Perl Monks concerning the following question:

I just saw today somebody using -E for Perl. I've always used just -e. So I looked at the man page and I find only one occurence of -E. There is no discussion of what -E does differently to -e. And if really nothing different, why have both?
  • Comment on Difference between -e and -E when invoking Perl

Replies are listed 'Best First'.
Re: Difference between -e and -E when invoking Perl
by hippo (Archbishop) on Mar 09, 2015 at 18:27 UTC
    There is no discussion of what -E does differently to -e.

    Sure there is. Here's the relevant bit of perlrun:

    -E commandline

    behaves just like -e, except that it implicitly enables all optional features (in the main compilation unit). See feature.
Re: Difference between -e and -E when invoking Perl
by karlgoethebier (Abbot) on Mar 09, 2015 at 18:27 UTC

    For example:

    karls-mac-mini:monks karl$ perl -E 'say qq(Hello World!)' Hello World! karls-mac-mini:monks karl$ perl -e 'say qq(Hello World!)' syntax error at -e line 1, near "say qq(Hello World!)" Execution of -e aborted due to compilation errors. karls-mac-mini:monks karl$ perl -e 'print qq(Hello World!)' Hello World!

    «The Crux of the Biscuit is the Apostrophe»

Re: Difference between -e and -E when invoking Perl
by Corion (Patriarch) on Mar 09, 2015 at 18:27 UTC

    I'm not sure which "man page" you looked at that only discussed -E.

    The man page provided with Perl, perlrun certainly explains both, -e and -E. It's also quite weird to only explain -E and not -e, as they are so similar.