Bug#843803: Please catch illegal use of $F[0..1] as syntax error

積丹尼 Dan Jacobson jidanni at jidanni.org
Wed Nov 9 18:43:28 UTC 2016


Package: perl
Version: 5.24.1~rc3-3
Severity: wishlist

Please catch illegal use of $F[0..1] as syntax error.

Else it gets interference from "$."!

use strict;
use warnings FATAL => q(all);
$_=`ps -axo pid=`;
my $c;
for(split){
    last if ++$c > 5;
    open N, "/proc/$_/stat" or next;
    my @F = split " ", <N>;
    close N;
    print  "@F[0..$c]\n=>$F[0..1]\n\n";
}
my @A=(7..99);
print $A[0..1],"\n";
print $A[0..2],"\n";
print $A[1..2],"\n";

Tell the user
die "Did you mean @F[0..1]?"

Thanks.




More information about the Perl-maintainers mailing list