📄 toke
字号:
$a = 123.456E_12; printf("%.0f\n", $a);$a = 123.456E1_2; printf("%.0f\n", $a);$a = 123.456E12_; printf("%.0f\n", $a);$a = 123.456E_+12; printf("%.0f\n", $a);$a = 123.456E+_12; printf("%.0f\n", $a);$a = 123.456E+1_2; printf("%.0f\n", $a);$a = 123.456E+12_; printf("%.0f\n", $a);$a = 123.456E_-12; print "$a\n";$a = 123.456E-_12; print "$a\n";$a = 123.456E-1_2; print "$a\n";$a = 123.456E-12_; print "$a\n";$a = 1__23; print "$a\n";$a = 12.3__4; print "$a\n";$a = 12.34e1__2; printf("%.0f\n", $a);EXPECTOPTIONS regexMisplaced _ in number at - line 6.Misplaced _ in number at - line 11.Misplaced _ in number at - line 16.Misplaced _ in number at - line 17.Misplaced _ in number at - line 20.Misplaced _ in number at - line 21.Misplaced _ in number at - line 24.Misplaced _ in number at - line 25.Misplaced _ in number at - line 28.Misplaced _ in number at - line 29.Misplaced _ in number at - line 31.Misplaced _ in number at - line 32.Misplaced _ in number at - line 33.Misplaced _ in number at - line 35.Misplaced _ in number at - line 36.Misplaced _ in number at - line 37.Misplaced _ in number at - line 39.Misplaced _ in number at - line 40.Misplaced _ in number at - line 41.Misplaced _ in number at - line 42._123123123123123_123123123123-123-_123-123-123-123123.456123.456123.456123.456123.456123.456123.456123.456-123.456-123.456-123.456-123.4561234560000000001234560000000001234560000000001234560000000001234560000000001234560000000001234560000000001.23456e-0?101.23456e-0?101.23456e-0?101.23456e-0?1012312.3412340000000000_123123123123123_123123123123-123-_123-123-123-123123.456123.456123.456123.456123.456123.456123.456123.456-123.456-123.456-123.456-123.4561234560000000001234560000000001234560000000001234560000000001234560000000001234560000000001234560000000001.23456e-0?101.23456e-0?101.23456e-0?101.23456e-0?1012312.3412340000000000######### toke.cuse warnings 'bareword' ;#line 25 "bar"$a = FRED:: ;no warnings 'bareword' ;#line 25 "bar"$a = FRED:: ;EXPECTBareword "FRED::" refers to nonexistent package at bar line 25.######### toke.cuse warnings 'ambiguous' ;sub time {}my $a = time() ;no warnings 'ambiguous' ;my $b = time() ;EXPECTAmbiguous call resolved as CORE::time(), qualify as such or use & at - line 4.######### toke.cuse warnings ;eval <<'EOE';# line 30 "foo"warn "yelp";{ $_ = " \x{123} " ;}EOEEXPECTyelp at foo line 30.######### toke.cmy $a = rand + 4 ;EXPECTWarning: Use of "rand" without parentheses is ambiguous at - line 2.######### toke.c$^W = 0 ;my $a = rand + 4 ;{ no warnings 'ambiguous' ; $a = rand + 4 ; use warnings 'ambiguous' ; $a = rand + 4 ;}$a = rand + 4 ;EXPECTWarning: Use of "rand" without parentheses is ambiguous at - line 3.Warning: Use of "rand" without parentheses is ambiguous at - line 8.Warning: Use of "rand" without parentheses is ambiguous at - line 10.######### toke.cuse warnings "ambiguous";print for keys %+; # should not warnEXPECT######### toke.csub fred {};-fred ;EXPECTAmbiguous use of -fred resolved as -&fred() at - line 3.######### toke.c$^W = 0 ;sub fred {} ;-fred ;{ no warnings 'ambiguous' ; -fred ; use warnings 'ambiguous' ; -fred ;}-fred ;EXPECTAmbiguous use of -fred resolved as -&fred() at - line 4.Ambiguous use of -fred resolved as -&fred() at - line 9.Ambiguous use of -fred resolved as -&fred() at - line 11.######### toke.copen FOO || time;EXPECTPrecedence problem: open FOO should be open(FOO) at - line 2.######### toke.c (and [perl #16184])open FOO => "<&0"; close FOO;EXPECT######### toke.c$^W = 0 ;open FOO || time;{ no warnings 'precedence' ; open FOO || time; use warnings 'precedence' ; open FOO || time;}open FOO || time;EXPECTPrecedence problem: open FOO should be open(FOO) at - line 3.Precedence problem: open FOO should be open(FOO) at - line 8.Precedence problem: open FOO should be open(FOO) at - line 10.######### toke.c$^W = 0 ;*foo *foo ;{ no warnings 'ambiguous' ; *foo *foo ; use warnings 'ambiguous' ; *foo *foo ;}*foo *foo ;EXPECTOperator or semicolon missing before *foo at - line 3.Ambiguous use of * resolved as operator * at - line 3.Operator or semicolon missing before *foo at - line 8.Ambiguous use of * resolved as operator * at - line 8.Operator or semicolon missing before *foo at - line 10.Ambiguous use of * resolved as operator * at - line 10.######### toke.cuse warnings 'misc' ;my $a = "\m" ;no warnings 'misc' ;$a = "\m" ;EXPECTUnrecognized escape \m passed through at - line 3.######### toke.cuse warnings 'portable' ;my $a = 0b011111111111111111111111111111110 ; $a = 0b011111111111111111111111111111111 ; $a = 0b111111111111111111111111111111111 ; $a = 0x0fffffffe ; $a = 0x0ffffffff ; $a = 0x1ffffffff ; $a = 0037777777776 ; $a = 0037777777777 ; $a = 0047777777777 ;no warnings 'portable' ; $a = 0b011111111111111111111111111111110 ; $a = 0b011111111111111111111111111111111 ; $a = 0b111111111111111111111111111111111 ; $a = 0x0fffffffe ; $a = 0x0ffffffff ; $a = 0x1ffffffff ; $a = 0037777777776 ; $a = 0037777777777 ; $a = 0047777777777 ;EXPECTBinary number > 0b11111111111111111111111111111111 non-portable at - line 5.Hexadecimal number > 0xffffffff non-portable at - line 8.Octal number > 037777777777 non-portable at - line 11.######### toke.cuse warnings 'overflow' ;my $a = 0b011111111111111111111111111111110 ; $a = 0b011111111111111111111111111111111 ; $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; $a = 0x0fffffffe ; $a = 0x0ffffffff ; $a = 0x10000000000000000 ; $a = 0037777777776 ; $a = 0037777777777 ; $a = 002000000000000000000000;no warnings 'overflow' ; $a = 0b011111111111111111111111111111110 ; $a = 0b011111111111111111111111111111111 ; $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; $a = 0x0fffffffe ; $a = 0x0ffffffff ; $a = 0x10000000000000000 ; $a = 0037777777776 ; $a = 0037777777777 ; $a = 002000000000000000000000;EXPECTInteger overflow in binary number at - line 5.Integer overflow in hexadecimal number at - line 8.Integer overflow in octal number at - line 11.######### toke.cBEGIN { $^C = 1; }use warnings 'misc';dump;CORE::dump;EXPECTdump() better written as CORE::dump() at - line 4.- syntax OK######### toke.cuse warnings 'misc';use subs qw/dump/;sub dump { print "no warning for overriden dump\n"; }dump;EXPECTno warning for overriden dump######### toke.cuse warnings 'ambiguous';"@mjd_previously_unused_array"; no warnings 'ambiguous';"@mjd_previously_unused_array"; EXPECTPossible unintended interpolation of @mjd_previously_unused_array in string at - line 3.######### toke.c# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.comuse warnings 'regexp';"foo" =~ /foo/c;"foo" =~ /foo/cg;no warnings 'regexp';"foo" =~ /foo/c;"foo" =~ /foo/cg;EXPECTUse of /c modifier is meaningless without /g at - line 4.######### toke.c# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.comuse warnings 'regexp';$_ = "ab" ; s/ab/ab/c;s/ab/ab/cg;no warnings 'regexp';s/ab/ab/c;s/ab/ab/cg;EXPECTUse of /c modifier is meaningless in s/// at - line 5.Use of /c modifier is meaningless in s/// at - line 6.########-wa# toke.c# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warningsprint "@F\n";EXPECT########-w# toke.c# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warningsprint "@F\n";EXPECTPossible unintended interpolation of @F in string at - line 4.Name "main::F" used only once: possible typo at - line 4.########-wa# toke.c# 20020414 mjd-perl-patch+@plover.comEXPECT######### toke.c# 20020414 mjd-perl-patch+@plover.com# In 5.7.3, this emitted "Possible unintended interpolation" warningsuse warnings 'ambiguous';$s = "(@-)(@+)";EXPECT######### toke.c# mandatory warningeval q/if ($a) { } elseif ($b) { }/;no warnings "syntax";eval q/if ($a) { } elseif ($b) { }/;EXPECTelseif should be elsif at (eval 1) line 1.######### toke.c# mandatory warningeval q/5 6/;no warnings "syntax";eval q/5 6/;EXPECTNumber found where operator expected at (eval 1) line 1, near "5 6" (Missing operator before 6?)######### toke.cuse warnings "syntax";$_ = $a = 1;$a !=~ /1/;$a !=~ m#1#;$a !=~/1/;$a !=~ ?/?;$a !=~ y/1//;$a !=~ tr/1//;$a !=~ s/1//;$a != ~/1/;no warnings "syntax";$a !=~ /1/;$a !=~ m#1#;$a !=~/1/;$a !=~ ?/?;$a !=~ y/1//;$a !=~ tr/1//;$a !=~ s/1//;EXPECT!=~ should be !~ at - line 4.!=~ should be !~ at - line 5.!=~ should be !~ at - line 6.!=~ should be !~ at - line 7.!=~ should be !~ at - line 8.!=~ should be !~ at - line 9.!=~ should be !~ at - line 10.######### toke.cour $foo :unique;use warnings 'deprecated';our $bar :unique;EXPECTUse of :unique is deprecated at - line 4.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -