in reply to diagnostics: warning, deprecation, error

All of these diagnostics are explained in perldiag.

Experimental %s on scalar is now forbidden
$ perl -e'my $x = { }; keys $x;' Experimental keys on scalar is now forbidden at -e line 1. Type of arg 1 to keys must be hash or array (not private variable) at +-e line 1, at EOF Execution of -e aborted due to compilation errors.

Bad operand type, but it was once accepted by an experimental feature.

Initialization of state variables in list currently forbidden
$ perl -e'use feature qw( state ); ( state $x ) = 123;' Initialization of state variables in list currently forbidden at -e li +ne 1, near "123;" Execution of -e aborted due to compilation errors.
$ perl -e'use feature qw( state ); state( $x ) = 123;' Initialization of state variables in list currently forbidden at -e li +ne 1, near "123;" Execution of -e aborted due to compilation errors.

Never supported.

Setting $/ to a reference to %s is forbidden
$ perl -e'$/ = \0;' Setting $/ to a reference to zero is forbidden at -e line 1.

Bad data.

Setting $/ to %s reference is forbidden
$ perl -e'$/ = { };' Setting $/ to a HASH reference is forbidden at -e line 1.

Bad data.

Use of bare << to mean <<"" is forbidden
$ perl my $x = <<. Use of bare << to mean <<"" is forbidden at - line 1.

Bad syntax. Non-word terminators must be quoted.

Use of strings with code points over 0xFF as arguments to vec is forbidden
$ perl -e'my $x = chr( 0x2660 ); vec( $x, 0, 1 );' Use of strings with code points over 0xFF as arguments to vec is forbi +dden at -e line 1.

Bad data. This is basically a friendly version of "Wide character in %s".

Replies are listed 'Best First'.
Re^2: diagnostics: warning, deprecation, error
by Anonymous Monk on Feb 10, 2026 at 16:01 UTC

    no longer supported

    perl -MConfig=compile_date -le'$|++;for(`perldoc -u perldiag`){print${ +1}and$-++if/^=item\s+(\S\S.*)$/}print(($-+1)," diagnostic warnings, d +eprecations, errors in perl $^V ").compile_date()' | grep -i 'no long +er supported'
    \C no longer supported in regex; marked by S<<-- HERE> in m/%s/
    ${^ENCODING} is no longer supported
    $* is no longer supported as of Perl 5.30
    $# is no longer supported as of Perl 5.30
    

    did you mean

    perl -MConfig=compile_date -le'$|++;for(`perldoc -u perldiag`){print${ +1}and$-++if/^=item\s+(\S\S.*)$/}print(($-+1)," diagnostic warnings, d +eprecations, errors in perl $^V ").compile_date()' | grep -i 'did you + mean'
    (Did you mean &%s instead?)
    (Did you mean "local" instead of "our"?)
    (Did you mean $ or @ instead of %?)
    do "%s" failed, '.' is no longer in @INC; did you mean do "./%s"?
    length() used on %s (did you mean "scalar(%s)"?)
    Perl %s required (did you mean %s?)--this is only %s, stopped
    $[ used in %s (did you mean $] ?)
    

    crash

    perl -MConfig=compile_date -le'$|++;for(`perldoc -u perldiag`){print${ +1}and$-++if/^=item\s+(\S\S.*)$/}print(($-+1)," diagnostic warnings, d +eprecations, errors in perl $^V ").compile_date()' | grep -i crash
    Locale '%s' is unsupported, and may crash the interpreter
    

      Do you have a point or a question?

        Usual perl error:
        perl -MSuper::Duper -e 'print Super::Duper->new->thing'

        Can't locate Super/Duper.pm in @INC (you may need to install the Super::Duper module) (@INC entries checked: /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/site_perl/5.42.0/darwin-2level /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/site_perl/5.42.0 /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/5.42.0/darwin-2level /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/5.42.0).
        BEGIN failed--compilation aborted.
        

        Improved perl error:
        perl -MIPC::Cmd=run -le '@_=run(command=>"perl -MSuper::Duper");$_=joi +n"",@{$_[2]};s/ ([\(])/\n/g;s/ ([\/])/\n $1/g;s/\)//g;chomp;print'

        Can't locate Super/Duper.pm in @INC
        you may need to install the Super::Duper module
        @INC entries checked:
         /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/site_perl/5.42.0/darwin-2level
         /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/site_perl/5.42.0
         /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/5.42.0/darwin-2level
         /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/5.42.0.
        BEGIN failed--compilation aborted.
        

        Ideal perl error? (formatted nice like perl -v):
        Can't locate Super/Duper.pm in @INC
        See: perldoc -v @INC
        
        You may need to install the Super::Duper module!
        https://metacpan.org/search?q=Super::Duper
        
        @INC entries checked:
         /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/site_perl/5.42.0/darwin-2level
         /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/site_perl/5.42.0
         /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/5.42.0/darwin-2level
         /Users/u/perl5/perlbrew/perls/perl-5.42.0/lib/5.42.0.
        
        BEGIN failed--compilation aborted.