Perl CORE::say vs -E

后端 未结 2 1016
栀梦
栀梦 2021-01-04 13:25

In this answer is used the perl one-liner as:

perl -we \'... CORE::say \"x=$x\"\'

What is the advantage using the -e and

2条回答
  •  Happy的楠姐
    2021-01-04 14:29

    You can see the difference like this:

    C:\> perl -MO=Deparse -E "say"
    use feature 'current_sub', 'evalbytes', 'fc', 'postderef_qq', 'say', 'state', 'switch', 'unicode_strings', 'unicode_eval';
    say $_;

    This is with perl 5.24.1 Now, without -E:

    C:\> perl -MO=Deparse -e "CORE::say"
    CORE::say $_;
    -e syntax OK

    The feature set included with -E will change in later versions (e.g. subroutine signatures) the wholesale inclusion of which may break existing programs. On the other hand, the latter will work with version 5.16 and later as @ikegami listed without other features clashing with programs written before their introduction.

提交回复
热议问题