This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regen/genpacksizetables.pl: Add comment
[perl5.git] / t / lib / warnings / toke
CommitLineData
599cee73
PM
1toke.c AOK
2
3 we seem to have lost a few ambiguous warnings!!
4
5
599cee73
PM
6 $a = <<;
7 Use of comma-less variable list is deprecated
8 (called 3 times via depcom)
9
10 \1 better written as $1
4438c4b7 11 use warnings 'syntax' ;
599cee73
PM
12 s/(abc)/\1/;
13
14 warn(warn_nosemi)
15 Semicolon seems to be missing
16 $a = 1
17 &time ;
18
19
20 Reversed %c= operator
21 my $a =+ 2 ;
22 $a =- 2 ;
23 $a =* 2 ;
24 $a =% 2 ;
25 $a =& 2 ;
26 $a =. 2 ;
27 $a =^ 2 ;
28 $a =| 2 ;
29 $a =< 2 ;
30 $a =/ 2 ;
31
32 Multidimensional syntax %.*s not supported
33 my $a = $a[1,2] ;
34
35 You need to quote \"%s\""
36 sub fred {} ; $SIG{TERM} = fred;
37
38 Scalar value %.*s better written as $%.*s"
39 @a[3] = 2;
40 @a{3} = 2;
41
42 Can't use \\%c to mean $%c in expression
43 $_ = "ab" ; s/(ab)/\1/e;
44
45 Unquoted string "abc" may clash with future reserved word at - line 3.
46 warn(warn_reserved
47 $a = abc;
48
599cee73
PM
49 Possible attempt to separate words with commas
50 @a = qw(a, b, c) ;
51
52 Possible attempt to put comments in qw() list
53 @a = qw(a b # c) ;
54
599cee73
PM
55 %s (...) interpreted as function
56 print ("")
57 printf ("")
58 sort ("")
59
60 Ambiguous use of %c{%s%s} resolved to %c%s%s
61 $a = ${time[2]}
62 $a = ${time{2}}
63
64
65 Ambiguous use of %c{%s} resolved to %c%s
66 $a = ${time}
67 sub fred {} $a = ${fred}
68
69 Misplaced _ in number
70 $a = 1_2;
71 $a = 1_2345_6;
72
73 Bareword \"%s\" refers to nonexistent package
74 $a = FRED:: ;
75
76 Ambiguous call resolved as CORE::%s(), qualify as such or use &
77 sub time {}
78 my $a = time()
79
767a6a26
PM
80 Unrecognized escape \\%c passed through
81 $a = "\m" ;
82
820438b1 83 Useless use of \\E.
52ed07f6
BF
84 $a = "abcd\E" ;
85
767a6a26
PM
86 %s number > %s non-portable
87 my $a = 0b011111111111111111111111111111110 ;
88 $a = 0b011111111111111111111111111111111 ;
89 $a = 0b111111111111111111111111111111111 ;
90 $a = 0x0fffffffe ;
91 $a = 0x0ffffffff ;
92 $a = 0x1ffffffff ;
93 $a = 0037777777776 ;
94 $a = 0037777777777 ;
95 $a = 0047777777777 ;
96
97 Integer overflow in binary number
98 my $a = 0b011111111111111111111111111111110 ;
99 $a = 0b011111111111111111111111111111111 ;
100 $a = 0b111111111111111111111111111111111 ;
101 $a = 0x0fffffffe ;
102 $a = 0x0ffffffff ;
103 $a = 0x1ffffffff ;
104 $a = 0037777777776 ;
105 $a = 0037777777777 ;
106 $a = 0047777777777 ;
ac206dc8
RGS
107
108 dump() better written as CORE::dump()
4ac733c9
MJD
109
110 Use of /c modifier is meaningless without /g
111
64e578a2
MJD
112 Use of /c modifier is meaningless in s///
113
0453d815
PM
114 Mandatory Warnings
115 ------------------
116 Use of "%s" without parentheses is ambiguous [check_uni]
117 rand + 4
118
119 Ambiguous use of -%s resolved as -&%s() [yylex]
120 sub fred {} ; - fred ;
121
122 Precedence problem: open %.*s should be open(%.*s) [yylex]
123 open FOO || die;
124
125 Operator or semicolon missing before %c%s [yylex]
126 Ambiguous use of %c resolved as operator %c
127 *foo *foo
128
599cee73
PM
129__END__
130# toke.c
599cee73
PM
131format STDOUT =
132@<<< @||| @>>> @>>>
133$a $b "abc" 'def'
134.
4438c4b7 135no warnings 'deprecated' ;
0453d815
PM
136format STDOUT =
137@<<< @||| @>>> @>>>
138$a $b "abc" 'def'
139.
599cee73 140EXPECT
d1d15184
NC
141Use of comma-less variable list is deprecated at - line 4.
142Use of comma-less variable list is deprecated at - line 4.
143Use of comma-less variable list is deprecated at - line 4.
599cee73
PM
144########
145# toke.c
599cee73
PM
146$a = <<;
147
4438c4b7 148no warnings 'deprecated' ;
0453d815
PM
149$a = <<;
150
599cee73 151EXPECT
0da72d5e
KW
152Use of bare << to mean <<"" is deprecated at - line 2.
153########
154# toke.c
155$a =~ m/$foo/eq;
156$a =~ s/$foo/fool/seq;
157
158EXPECT
159OPTION fatal
160Unknown regexp modifier "/e" at - line 2, near "=~ "
161Unknown regexp modifier "/q" at - line 2, near "=~ "
162Unknown regexp modifier "/q" at - line 3, near "=~ "
163Execution of - aborted due to compilation errors.
84159251
BF
164########
165# toke.c
166use utf8;
167use open qw( :utf8 :std );
168$a =~ m/$foo/eネq;
169$a =~ s/$foo/fool/seネq;
170
171EXPECT
172OPTION fatal
173Unknown regexp modifier "/e" at - line 4, near "=~ "
174Unknown regexp modifier "/ネ" at - line 4, near "=~ "
175Unknown regexp modifier "/q" at - line 4, near "=~ "
176Unknown regexp modifier "/ネ" at - line 5, near "=~ "
177Unknown regexp modifier "/q" at - line 5, near "=~ "
178Execution of - aborted due to compilation errors.
599cee73
PM
179########
180# toke.c
4438c4b7 181use warnings 'syntax' ;
599cee73 182s/(abc)/\1/;
4438c4b7 183no warnings 'syntax' ;
0453d815 184s/(abc)/\1/;
599cee73
PM
185EXPECT
186\1 better written as $1 at - line 3.
187########
188# toke.c
4438c4b7 189use warnings 'semicolon' ;
599cee73
PM
190$a = 1
191&time ;
4438c4b7 192no warnings 'semicolon' ;
0453d815
PM
193$a = 1
194&time ;
599cee73
PM
195EXPECT
196Semicolon seems to be missing at - line 3.
197########
198# toke.c
4438c4b7 199use warnings 'syntax' ;
599cee73
PM
200my $a =+ 2 ;
201$a =- 2 ;
202$a =* 2 ;
203$a =% 2 ;
204$a =& 2 ;
205$a =. 2 ;
206$a =^ 2 ;
207$a =| 2 ;
208$a =< 2 ;
209$a =/ 2 ;
210EXPECT
7f01dc7a
JH
211Reversed += operator at - line 3.
212Reversed -= operator at - line 4.
213Reversed *= operator at - line 5.
214Reversed %= operator at - line 6.
215Reversed &= operator at - line 7.
216Reversed .= operator at - line 8.
217Reversed ^= operator at - line 9.
218Reversed |= operator at - line 10.
219Reversed <= operator at - line 11.
220syntax error at - line 8, near "=."
221syntax error at - line 9, near "=^"
222syntax error at - line 10, near "=|"
223Unterminated <> operator at - line 11.
599cee73
PM
224########
225# toke.c
4438c4b7 226no warnings 'syntax' ;
0453d815
PM
227my $a =+ 2 ;
228$a =- 2 ;
229$a =* 2 ;
230$a =% 2 ;
231$a =& 2 ;
232$a =. 2 ;
233$a =^ 2 ;
234$a =| 2 ;
235$a =< 2 ;
236$a =/ 2 ;
237EXPECT
7f01dc7a
JH
238syntax error at - line 8, near "=."
239syntax error at - line 9, near "=^"
240syntax error at - line 10, near "=|"
241Unterminated <> operator at - line 11.
0453d815
PM
242########
243# toke.c
4438c4b7 244use warnings 'syntax' ;
599cee73 245my $a = $a[1,2] ;
4438c4b7 246no warnings 'syntax' ;
0453d815 247my $a = $a[1,2] ;
599cee73
PM
248EXPECT
249Multidimensional syntax $a[1,2] not supported at - line 3.
250########
251# toke.c
4438c4b7 252use warnings 'syntax' ;
599cee73 253sub fred {} ; $SIG{TERM} = fred;
4438c4b7 254no warnings 'syntax' ;
0453d815 255$SIG{TERM} = fred;
599cee73
PM
256EXPECT
257You need to quote "fred" at - line 3.
258########
259# toke.c
4c01a014
BF
260use utf8;
261use open qw( :utf8 :std );
262use warnings 'syntax' ;
263sub frèd {} ; $SIG{TERM} = frèd;
264no warnings 'syntax' ;
265$SIG{TERM} = frèd;
266EXPECT
267You need to quote "frèd" at - line 5.
268########
269# toke.c
270use utf8;
271use open qw( :utf8 :std );
272use warnings 'syntax' ;
273sub ふれど {} ; $SIG{TERM} = ふれど;
274no warnings 'syntax' ;
275$SIG{TERM} = ふれど;
276EXPECT
277You need to quote "ふれど" at - line 5.
278########
279# toke.c
4438c4b7 280use warnings 'syntax' ;
599cee73
PM
281@a[3] = 2;
282@a{3} = 2;
4438c4b7 283no warnings 'syntax' ;
0453d815
PM
284@a[3] = 2;
285@a{3} = 2;
599cee73
PM
286EXPECT
287Scalar value @a[3] better written as $a[3] at - line 3.
288Scalar value @a{3} better written as $a{3} at - line 4.
289########
290# toke.c
b9e186cd
BF
291use utf8;
292use open qw( :utf8 :std );
293use warnings 'syntax' ;
294@à[3] = 2;
295@à{3} = 2;
296no warnings 'syntax' ;
297@à[3] = 2;
298@à{3} = 2;
299EXPECT
300Scalar value @à[3] better written as $à[3] at - line 5.
301Scalar value @à{3} better written as $à{3} at - line 6.
302########
303# toke.c
304use utf8;
305use open qw( :utf8 :std );
306use warnings 'syntax' ;
307@ぁ[3] = 2;
308@ぁ{3} = 2;
309no warnings 'syntax' ;
310@ぁ[3] = 2;
311@ぁ{3} = 2;
312EXPECT
313Scalar value @ぁ[3] better written as $ぁ[3] at - line 5.
314Scalar value @ぁ{3} better written as $ぁ{3} at - line 6.
315########
316# toke.c
4438c4b7 317use warnings 'syntax' ;
599cee73
PM
318$_ = "ab" ;
319s/(ab)/\1/e;
4438c4b7 320no warnings 'syntax' ;
0453d815
PM
321$_ = "ab" ;
322s/(ab)/\1/e;
599cee73
PM
323EXPECT
324Can't use \1 to mean $1 in expression at - line 4.
325########
326# toke.c
4438c4b7 327use warnings 'reserved' ;
599cee73 328$a = abc;
1c3923b3
GS
329$a = { def
330
331=> 1 };
4438c4b7 332no warnings 'reserved' ;
0453d815 333$a = abc;
599cee73
PM
334EXPECT
335Unquoted string "abc" may clash with future reserved word at - line 3.
336########
337# toke.c
e476b1b5 338use warnings 'qw' ;
599cee73 339@a = qw(a, b, c) ;
e476b1b5 340no warnings 'qw' ;
0453d815 341@a = qw(a, b, c) ;
599cee73
PM
342EXPECT
343Possible attempt to separate words with commas at - line 3.
344########
345# toke.c
e476b1b5 346use warnings 'qw' ;
7e03b518 347@a = qw(a b c # #) ;
e476b1b5 348no warnings 'qw' ;
7e03b518 349@a = qw(a b c # #) ;
599cee73
PM
350EXPECT
351Possible attempt to put comments in qw() list at - line 3.
352########
353# toke.c
7e03b518
EB
354use warnings 'qw' ;
355@a = qw(a, b, c # #) ;
356no warnings 'qw' ;
357@a = qw(a, b, c # #) ;
358EXPECT
359Possible attempt to separate words with commas at - line 3.
360Possible attempt to put comments in qw() list at - line 3.
361########
362# toke.c
4438c4b7 363use warnings 'syntax' ;
b1439985
RGS
364print ("");
365print ("") and $x = 1;
366print ("") or die;
367print ("") // die;
368print (1+2) * 3 if 0; # only this one should warn
369print (1+2) if 0;
599cee73 370EXPECT
b1439985 371print (...) interpreted as function at - line 7.
599cee73
PM
372########
373# toke.c
4438c4b7 374no warnings 'syntax' ;
0453d815
PM
375print ("")
376EXPECT
377
378########
379# toke.c
4438c4b7 380use warnings 'syntax' ;
b1439985
RGS
381printf ("");
382printf ("") . '';
599cee73 383EXPECT
b1439985 384printf (...) interpreted as function at - line 4.
599cee73
PM
385########
386# toke.c
4438c4b7 387no warnings 'syntax' ;
0453d815
PM
388printf ("")
389EXPECT
390
391########
392# toke.c
4438c4b7 393use warnings 'syntax' ;
b1439985
RGS
394sort ("");
395sort ("") . '';
599cee73 396EXPECT
b1439985 397sort (...) interpreted as function at - line 4.
599cee73
PM
398########
399# toke.c
4438c4b7 400no warnings 'syntax' ;
0453d815
PM
401sort ("")
402EXPECT
403
404########
405# toke.c
4438c4b7 406use warnings 'ambiguous' ;
599cee73 407$a = ${time[2]};
4438c4b7 408no warnings 'ambiguous' ;
0453d815 409$a = ${time[2]};
599cee73
PM
410EXPECT
411Ambiguous use of ${time[...]} resolved to $time[...] at - line 3.
412########
413# toke.c
4438c4b7 414use warnings 'ambiguous' ;
599cee73
PM
415$a = ${time{2}};
416EXPECT
417Ambiguous use of ${time{...}} resolved to $time{...} at - line 3.
418########
419# toke.c
4438c4b7 420no warnings 'ambiguous' ;
0453d815
PM
421$a = ${time{2}};
422EXPECT
423
424########
425# toke.c
4438c4b7 426use warnings 'ambiguous' ;
599cee73 427$a = ${time} ;
27ffb73a
NC
428$a = @{time} ;
429$a = $#{time} ; # This one is special cased in toke.c
430$a = %{time} ;
431$a = *{time} ;
432$a = defined &{time} ; # To avoid calling &::time
4438c4b7 433no warnings 'ambiguous' ;
0453d815 434$a = ${time} ;
27ffb73a
NC
435$a = @{time} ;
436$a = $#{time} ; # This one is special cased in toke.c
437$a = %{time} ;
438$a = *{time} ;
439$a = defined &{time} ; # To avoid calling &::time
599cee73
PM
440EXPECT
441Ambiguous use of ${time} resolved to $time at - line 3.
27ffb73a
NC
442Ambiguous use of @{time} resolved to @time at - line 4.
443Ambiguous use of @{time} resolved to @time at - line 5.
444Ambiguous use of %{time} resolved to %time at - line 6.
445Ambiguous use of *{time} resolved to *time at - line 7.
446Ambiguous use of &{time} resolved to &time at - line 8.
599cee73
PM
447########
448# toke.c
4438c4b7 449use warnings 'ambiguous' ;
599cee73
PM
450sub fred {}
451$a = ${fred} ;
4438c4b7 452no warnings 'ambiguous' ;
0453d815 453$a = ${fred} ;
599cee73
PM
454EXPECT
455Ambiguous use of ${fred} resolved to $fred at - line 4.
456########
457# toke.c
4438c4b7 458use warnings 'syntax' ;
7fd134d9
JH
459$a = _123; print "$a\n"; #( 3 string)
460$a = 1_23; print "$a\n";
461$a = 12_3; print "$a\n";
462$a = 123_; print "$a\n"; # 6
463$a = _+123; print "$a\n"; # 7 string)
464$a = +_123; print "$a\n"; #( 8 string)
465$a = +1_23; print "$a\n";
466$a = +12_3; print "$a\n";
467$a = +123_; print "$a\n"; # 11
468$a = _-123; print "$a\n"; #(12 string)
469$a = -_123; print "$a\n"; #(13 string)
470$a = -1_23; print "$a\n";
471$a = -12_3; print "$a\n";
472$a = -123_; print "$a\n"; # 16
473$a = 123._456; print "$a\n"; # 17
474$a = 123.4_56; print "$a\n";
475$a = 123.45_6; print "$a\n";
476$a = 123.456_; print "$a\n"; # 20
477$a = +123._456; print "$a\n"; # 21
478$a = +123.4_56; print "$a\n";
479$a = +123.45_6; print "$a\n";
480$a = +123.456_; print "$a\n"; # 24
481$a = -123._456; print "$a\n"; # 25
482$a = -123.4_56; print "$a\n";
483$a = -123.45_6; print "$a\n";
484$a = -123.456_; print "$a\n"; # 28
2bea9a37
JH
485$a = 123.456E_12; printf("%.0f\n", $a); # 29
486$a = 123.456E1_2; printf("%.0f\n", $a);
487$a = 123.456E12_; printf("%.0f\n", $a); # 31
488$a = 123.456E_+12; printf("%.0f\n", $a); # 32
489$a = 123.456E+_12; printf("%.0f\n", $a); # 33
490$a = 123.456E+1_2; printf("%.0f\n", $a);
491$a = 123.456E+12_; printf("%.0f\n", $a); # 35
7fd134d9
JH
492$a = 123.456E_-12; print "$a\n"; # 36
493$a = 123.456E-_12; print "$a\n"; # 37
494$a = 123.456E-1_2; print "$a\n";
495$a = 123.456E-12_; print "$a\n"; # 39
b3b48e3e
JH
496$a = 1__23; print "$a\n"; # 40
497$a = 12.3__4; print "$a\n"; # 41
2bea9a37 498$a = 12.34e1__2; printf("%.0f\n", $a); # 42
4438c4b7 499no warnings 'syntax' ;
7fd134d9
JH
500$a = _123; print "$a\n";
501$a = 1_23; print "$a\n";
502$a = 12_3; print "$a\n";
503$a = 123_; print "$a\n";
504$a = _+123; print "$a\n";
505$a = +_123; print "$a\n";
506$a = +1_23; print "$a\n";
507$a = +12_3; print "$a\n";
508$a = +123_; print "$a\n";
509$a = _-123; print "$a\n";
510$a = -_123; print "$a\n";
511$a = -1_23; print "$a\n";
512$a = -12_3; print "$a\n";
513$a = -123_; print "$a\n";
514$a = 123._456; print "$a\n";
515$a = 123.4_56; print "$a\n";
516$a = 123.45_6; print "$a\n";
517$a = 123.456_; print "$a\n";
518$a = +123._456; print "$a\n";
519$a = +123.4_56; print "$a\n";
520$a = +123.45_6; print "$a\n";
521$a = +123.456_; print "$a\n";
522$a = -123._456; print "$a\n";
523$a = -123.4_56; print "$a\n";
524$a = -123.45_6; print "$a\n";
525$a = -123.456_; print "$a\n";
2bea9a37
JH
526$a = 123.456E_12; printf("%.0f\n", $a);
527$a = 123.456E1_2; printf("%.0f\n", $a);
528$a = 123.456E12_; printf("%.0f\n", $a);
529$a = 123.456E_+12; printf("%.0f\n", $a);
530$a = 123.456E+_12; printf("%.0f\n", $a);
531$a = 123.456E+1_2; printf("%.0f\n", $a);
532$a = 123.456E+12_; printf("%.0f\n", $a);
7fd134d9
JH
533$a = 123.456E_-12; print "$a\n";
534$a = 123.456E-_12; print "$a\n";
535$a = 123.456E-1_2; print "$a\n";
536$a = 123.456E-12_; print "$a\n";
b3b48e3e
JH
537$a = 1__23; print "$a\n";
538$a = 12.3__4; print "$a\n";
2bea9a37 539$a = 12.34e1__2; printf("%.0f\n", $a);
599cee73 540EXPECT
fbfa96bd 541OPTIONS regex
928753ea 542Misplaced _ in number at - line 6.
928753ea 543Misplaced _ in number at - line 11.
7fd134d9 544Misplaced _ in number at - line 16.
928753ea 545Misplaced _ in number at - line 17.
7fd134d9 546Misplaced _ in number at - line 20.
928753ea 547Misplaced _ in number at - line 21.
7fd134d9
JH
548Misplaced _ in number at - line 24.
549Misplaced _ in number at - line 25.
550Misplaced _ in number at - line 28.
551Misplaced _ in number at - line 29.
552Misplaced _ in number at - line 31.
553Misplaced _ in number at - line 32.
554Misplaced _ in number at - line 33.
555Misplaced _ in number at - line 35.
556Misplaced _ in number at - line 36.
557Misplaced _ in number at - line 37.
558Misplaced _ in number at - line 39.
b3b48e3e
JH
559Misplaced _ in number at - line 40.
560Misplaced _ in number at - line 41.
561Misplaced _ in number at - line 42.
928753ea
JH
562_123
563123
928753ea 564123
7fd134d9
JH
565123
566123
567_123
568123
569123
570123
571-123
572-_123
573-123
574-123
575-123
576123.456
577123.456
578123.456
579123.456
580123.456
581123.456
582123.456
583123.456
584-123.456
585-123.456
586-123.456
587-123.456
588123456000000000
589123456000000000
590123456000000000
591123456000000000
592123456000000000
593123456000000000
594123456000000000
fbfa96bd
NIS
5951.23456e-0?10
5961.23456e-0?10
5971.23456e-0?10
5981.23456e-0?10
b3b48e3e
JH
599123
60012.34
60112340000000000
7fd134d9
JH
602_123
603123
604123
605123
606123
607_123
608123
609123
610123
611-123
612-_123
613-123
614-123
615-123
616123.456
617123.456
618123.456
619123.456
620123.456
928753ea
JH
621123.456
622123.456
928753ea 623123.456
7fd134d9
JH
624-123.456
625-123.456
626-123.456
627-123.456
628123456000000000
629123456000000000
630123456000000000
631123456000000000
632123456000000000
633123456000000000
634123456000000000
fbfa96bd
NIS
6351.23456e-0?10
6361.23456e-0?10
6371.23456e-0?10
6381.23456e-0?10
b3b48e3e
JH
639123
64012.34
64112340000000000
599cee73
PM
642########
643# toke.c
e476b1b5 644use warnings 'bareword' ;
60e6418e 645#line 25 "bar"
599cee73 646$a = FRED:: ;
e476b1b5 647no warnings 'bareword' ;
0453d815
PM
648#line 25 "bar"
649$a = FRED:: ;
599cee73 650EXPECT
60e6418e 651Bareword "FRED::" refers to nonexistent package at bar line 25.
979a1401
BF
652########
653# toke.c
654use utf8;
655use open qw( :utf8 :std );
656use warnings 'bareword' ;
657#line 25 "bar"
658$a = FRÈD:: ;
659no warnings 'bareword' ;
660#line 25 "bar"
661$a = FRÈD:: ;
662EXPECT
663Bareword "FRÈD::" refers to nonexistent package at bar line 25.
664########
665# toke.c
666use utf8;
667use open qw( :utf8 :std );
668use warnings 'bareword' ;
669#line 25 "bar"
670$a = ϞϞϞ:: ;
671no warnings 'bareword' ;
672#line 25 "bar"
673$a = ϞϞϞ:: ;
674EXPECT
675Bareword "ϞϞϞ::" refers to nonexistent package at bar line 25.
599cee73
PM
676########
677# toke.c
4438c4b7 678use warnings 'ambiguous' ;
599cee73 679sub time {}
0453d815 680my $a = time() ;
4438c4b7 681no warnings 'ambiguous' ;
0453d815 682my $b = time() ;
599cee73
PM
683EXPECT
684Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4.
685########
686# toke.c
26d16222 687use warnings ;
0453d815 688eval <<'EOE';
df0deb90
GS
689# line 30 "foo"
690warn "yelp";
0453d815 691{
0453d815
PM
692 $_ = " \x{123} " ;
693}
694EOE
695EXPECT
df0deb90 696yelp at foo line 30.
0453d815
PM
697########
698# toke.c
0453d815 699my $a = rand + 4 ;
fbdd83da
DIM
700$a = rand *^H ;
701$a = rand $^H ;
0453d815 702EXPECT
2d5ccbba 703Warning: Use of "rand" without parentheses is ambiguous at - line 2.
0453d815
PM
704########
705# toke.c
706$^W = 0 ;
707my $a = rand + 4 ;
708{
4438c4b7 709 no warnings 'ambiguous' ;
0453d815 710 $a = rand + 4 ;
4438c4b7 711 use warnings 'ambiguous' ;
0453d815
PM
712 $a = rand + 4 ;
713}
714$a = rand + 4 ;
715EXPECT
2d5ccbba
IT
716Warning: Use of "rand" without parentheses is ambiguous at - line 3.
717Warning: Use of "rand" without parentheses is ambiguous at - line 8.
718Warning: Use of "rand" without parentheses is ambiguous at - line 10.
0453d815 719########
e19a021b
FC
720# [perl #97110]
721sub myrand(;$) { }
b5fb7ce3 722sub whatever($) { }
e19a021b 723my $a = myrand + 4 ;
b5fb7ce3 724my $b = whatever + 4 ;
e19a021b 725EXPECT
b5fb7ce3 726Warning: Use of "myrand" without parentheses is ambiguous at - line 4.
e19a021b 727########
0453d815 728# toke.c
e8ae98db
RGS
729use warnings "ambiguous";
730print for keys %+; # should not warn
731EXPECT
732########
733# toke.c
0453d815
PM
734sub fred {};
735-fred ;
898c3bca
FC
736sub hank : lvalue {$_}
737--hank; # This should *not* warn [perl #77240]
0453d815
PM
738EXPECT
739Ambiguous use of -fred resolved as -&fred() at - line 3.
740########
741# toke.c
742$^W = 0 ;
743sub fred {} ;
744-fred ;
745{
4438c4b7 746 no warnings 'ambiguous' ;
0453d815 747 -fred ;
4438c4b7 748 use warnings 'ambiguous' ;
0453d815
PM
749 -fred ;
750}
751-fred ;
752EXPECT
753Ambiguous use of -fred resolved as -&fred() at - line 4.
754Ambiguous use of -fred resolved as -&fred() at - line 9.
755Ambiguous use of -fred resolved as -&fred() at - line 11.
756########
757# toke.c
43b5ab4c
BF
758use utf8;
759use open qw( :utf8 :std );
760sub frèd {};
761-frèd ;
762EXPECT
763Ambiguous use of -frèd resolved as -&frèd() at - line 5.
764########
765# toke.c
766$^W = 0 ;
767use utf8;
768use open qw( :utf8 :std );
769sub frèd {} ;
770-frèd ;
771{
772 no warnings 'ambiguous' ;
773 -frèd ;
774 use warnings 'ambiguous' ;
775 -frèd ;
776}
777-frèd ;
778EXPECT
779Ambiguous use of -frèd resolved as -&frèd() at - line 6.
780Ambiguous use of -frèd resolved as -&frèd() at - line 11.
781Ambiguous use of -frèd resolved as -&frèd() at - line 13.
782########
783# toke.c
784use utf8;
785use open qw( :utf8 :std );
786sub ᒍᒘᒊ {};
787-ᒍᒘᒊ ;
788EXPECT
789Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 5.
790########
791# toke.c
792$^W = 0 ;
793use utf8;
794use open qw( :utf8 :std );
795sub ᒍᒘᒊ {} ;
796-ᒍᒘᒊ ;
797{
798 no warnings 'ambiguous' ;
799 -ᒍᒘᒊ ;
800 use warnings 'ambiguous' ;
801 -ᒍᒘᒊ ;
802}
803-ᒍᒘᒊ ;
804EXPECT
805Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 6.
806Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 11.
807Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 13.
808########
809# toke.c
0453d815 810open FOO || time;
240d1b6f 811open local *FOO; # should be ok
0453d815
PM
812EXPECT
813Precedence problem: open FOO should be open(FOO) at - line 2.
814########
71aa9713
BF
815# toke.c
816use utf8;
817use open qw( :utf8 :std );
818open FÒÒ || time;
819EXPECT
820Precedence problem: open FÒÒ should be open(FÒÒ) at - line 4.
821########
822# toke.c
823use utf8;
824use open qw( :utf8 :std );
825open ᒍOO || time;
826EXPECT
827Precedence problem: open ᒍOO should be open(ᒍOO) at - line 4.
828########
66fbe8fb
HS
829# toke.c (and [perl #16184])
830open FOO => "<&0"; close FOO;
831EXPECT
832########
0453d815
PM
833# toke.c
834$^W = 0 ;
835open FOO || time;
836{
e476b1b5 837 no warnings 'precedence' ;
0453d815 838 open FOO || time;
e476b1b5 839 use warnings 'precedence' ;
0453d815
PM
840 open FOO || time;
841}
842open FOO || time;
db3abe52 843open Foo::BAR; # this should not warn
0453d815
PM
844EXPECT
845Precedence problem: open FOO should be open(FOO) at - line 3.
846Precedence problem: open FOO should be open(FOO) at - line 8.
847Precedence problem: open FOO should be open(FOO) at - line 10.
848########
849# toke.c
850$^W = 0 ;
71aa9713
BF
851use utf8;
852use open qw( :utf8 :std );
853open FÒÒ || time;
854{
855 no warnings 'precedence' ;
856 open FÒÒ || time;
857 use warnings 'precedence' ;
858 open FÒÒ || time;
859}
860open FÒÒ || time;
861EXPECT
862Precedence problem: open FÒÒ should be open(FÒÒ) at - line 5.
863Precedence problem: open FÒÒ should be open(FÒÒ) at - line 10.
864Precedence problem: open FÒÒ should be open(FÒÒ) at - line 12.
865########
866# toke.c
867use utf8;
868use open qw( :utf8 :std );
869$^W = 0 ;
870open ᒍÒÒ || time;
871{
872 no warnings 'precedence' ;
873 open ᒍÒÒ || time;
874 use warnings 'precedence' ;
875 open ᒍÒÒ || time;
876}
877open ᒍÒÒ || time;
878EXPECT
879Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 5.
880Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 10.
881Precedence problem: open ᒍÒÒ should be open(ᒍÒÒ) at - line 12.
882########
883# toke.c
884$^W = 0 ;
0453d815
PM
885*foo *foo ;
886{
4438c4b7 887 no warnings 'ambiguous' ;
0453d815 888 *foo *foo ;
4438c4b7 889 use warnings 'ambiguous' ;
0453d815
PM
890 *foo *foo ;
891}
892*foo *foo ;
893EXPECT
894Operator or semicolon missing before *foo at - line 3.
895Ambiguous use of * resolved as operator * at - line 3.
896Operator or semicolon missing before *foo at - line 8.
897Ambiguous use of * resolved as operator * at - line 8.
898Operator or semicolon missing before *foo at - line 10.
899Ambiguous use of * resolved as operator * at - line 10.
767a6a26
PM
900########
901# toke.c
02571fe8
BF
902use utf8;
903use open qw( :utf8 :std );
904$^W = 0 ;
905*foo *foo ;
906{
907 no warnings 'ambiguous' ;
908 *foo *foo ;
909 use warnings 'ambiguous' ;
910 *foo *foo ;
911}
912*foo *foo ;
913EXPECT
914Operator or semicolon missing before *foo at - line 5.
915Ambiguous use of * resolved as operator * at - line 5.
916Operator or semicolon missing before *foo at - line 10.
917Ambiguous use of * resolved as operator * at - line 10.
918Operator or semicolon missing before *foo at - line 12.
919Ambiguous use of * resolved as operator * at - line 12.
920########
921# toke.c
e476b1b5 922use warnings 'misc' ;
767a6a26 923my $a = "\m" ;
e476b1b5 924no warnings 'misc' ;
767a6a26
PM
925$a = "\m" ;
926EXPECT
927Unrecognized escape \m passed through at - line 3.
928########
929# toke.c
52ed07f6
BF
930use warnings 'misc' ;
931my $a = "abcd\E" ;
932no warnings 'misc' ;
933$a = "abcd\E" ;
934EXPECT
820438b1 935Useless use of \E at - line 3.
52ed07f6
BF
936########
937# toke.c
767a6a26
PM
938use warnings 'portable' ;
939my $a = 0b011111111111111111111111111111110 ;
940 $a = 0b011111111111111111111111111111111 ;
941 $a = 0b111111111111111111111111111111111 ;
942 $a = 0x0fffffffe ;
943 $a = 0x0ffffffff ;
944 $a = 0x1ffffffff ;
945 $a = 0037777777776 ;
946 $a = 0037777777777 ;
947 $a = 0047777777777 ;
948no warnings 'portable' ;
949 $a = 0b011111111111111111111111111111110 ;
950 $a = 0b011111111111111111111111111111111 ;
951 $a = 0b111111111111111111111111111111111 ;
952 $a = 0x0fffffffe ;
953 $a = 0x0ffffffff ;
954 $a = 0x1ffffffff ;
955 $a = 0037777777776 ;
956 $a = 0037777777777 ;
957 $a = 0047777777777 ;
958EXPECT
959Binary number > 0b11111111111111111111111111111111 non-portable at - line 5.
960Hexadecimal number > 0xffffffff non-portable at - line 8.
961Octal number > 037777777777 non-portable at - line 11.
962########
963# toke.c
964use warnings 'overflow' ;
965my $a = 0b011111111111111111111111111111110 ;
966 $a = 0b011111111111111111111111111111111 ;
15041a67 967 $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ;
767a6a26
PM
968 $a = 0x0fffffffe ;
969 $a = 0x0ffffffff ;
15041a67 970 $a = 0x10000000000000000 ;
767a6a26
PM
971 $a = 0037777777776 ;
972 $a = 0037777777777 ;
15041a67 973 $a = 002000000000000000000000;
767a6a26
PM
974no warnings 'overflow' ;
975 $a = 0b011111111111111111111111111111110 ;
976 $a = 0b011111111111111111111111111111111 ;
15041a67 977 $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ;
767a6a26
PM
978 $a = 0x0fffffffe ;
979 $a = 0x0ffffffff ;
15041a67 980 $a = 0x10000000000000000 ;
767a6a26
PM
981 $a = 0037777777776 ;
982 $a = 0037777777777 ;
15041a67 983 $a = 002000000000000000000000;
767a6a26
PM
984EXPECT
985Integer overflow in binary number at - line 5.
986Integer overflow in hexadecimal number at - line 8.
987Integer overflow in octal number at - line 11.
8593bda5
GS
988########
989# toke.c
ac206dc8
RGS
990BEGIN { $^C = 1; }
991use warnings 'misc';
992dump;
993CORE::dump;
994EXPECT
995dump() better written as CORE::dump() at - line 4.
996- syntax OK
997########
998# toke.c
999use warnings 'misc';
1000use subs qw/dump/;
93f09d7b 1001sub dump { print "no warning for overridden dump\n"; }
ac206dc8
RGS
1002dump;
1003EXPECT
93f09d7b 1004no warning for overridden dump
ac206dc8
RGS
1005########
1006# toke.c
8593bda5
GS
1007use warnings 'ambiguous';
1008"@mjd_previously_unused_array";
1009no warnings 'ambiguous';
29fb1d0e 1010"@mjd_previously_unused_array2";
8593bda5
GS
1011EXPECT
1012Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3.
707afd92
MS
1013########
1014# toke.c
29fb1d0e
BF
1015use utf8;
1016use open qw( :utf8 :std );
1017use warnings 'ambiguous';
1018"@mjd_previously_unused_àrray";
1019no warnings 'ambiguous';
1020"@mjd_previously_unused_àrray2";
1021EXPECT
1022Possible unintended interpolation of @mjd_previously_unused_àrray in string at - line 5.
1023########
1024# toke.c
1025use utf8;
1026use open qw( :utf8 :std );
1027use warnings 'ambiguous';
1028"@mjd_previously_unused_ぁrrぁy";
1029no warnings 'ambiguous';
1030"@mjd_previously_unused_ぁrrぁy2";
1031EXPECT
1032Possible unintended interpolation of @mjd_previously_unused_ぁrrぁy in string at - line 5.
1033########
1034# toke.c
d8c55666 1035# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com
4ac733c9
MJD
1036use warnings 'regexp';
1037"foo" =~ /foo/c;
64e578a2 1038"foo" =~ /foo/cg;
4ac733c9
MJD
1039no warnings 'regexp';
1040"foo" =~ /foo/c;
64e578a2 1041"foo" =~ /foo/cg;
4ac733c9
MJD
1042EXPECT
1043Use of /c modifier is meaningless without /g at - line 4.
1044########
1045# toke.c
d8c55666 1046# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com
4ac733c9
MJD
1047use warnings 'regexp';
1048$_ = "ab" ;
1049s/ab/ab/c;
64e578a2 1050s/ab/ab/cg;
4ac733c9
MJD
1051no warnings 'regexp';
1052s/ab/ab/c;
64e578a2 1053s/ab/ab/cg;
4ac733c9 1054EXPECT
64e578a2
MJD
1055Use of /c modifier is meaningless in s/// at - line 5.
1056Use of /c modifier is meaningless in s/// at - line 6.
d8c55666
MJD
1057########
1058-wa
1059# toke.c
1060# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings
1061print "@F\n";
1062EXPECT
1063
1064########
1065-w
1066# toke.c
1067# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings
1068print "@F\n";
1069EXPECT
1070Possible unintended interpolation of @F in string at - line 4.
1071Name "main::F" used only once: possible typo at - line 4.
1072########
1073-wa
1074# toke.c
1075# 20020414 mjd-perl-patch+@plover.com
1076EXPECT
1077
2710853f
MJD
1078########
1079# toke.c
1080# 20020414 mjd-perl-patch+@plover.com
1081# In 5.7.3, this emitted "Possible unintended interpolation" warnings
1082use warnings 'ambiguous';
1083$s = "(@-)(@+)";
1084EXPECT
1085
56da5a46
RGS
1086########
1087# toke.c
1088# mandatory warning
1089eval q/if ($a) { } elseif ($b) { }/;
1090no warnings "syntax";
1091eval q/if ($a) { } elseif ($b) { }/;
1092EXPECT
1093elseif should be elsif at (eval 1) line 1.
1094########
1095# toke.c
1096# mandatory warning
1097eval q/5 6/;
1098no warnings "syntax";
1099eval q/5 6/;
1100EXPECT
1101Number found where operator expected at (eval 1) line 1, near "5 6"
1102 (Missing operator before 6?)
984200d0
YST
1103########
1104# toke.c
7fc874e8 1105use warnings "syntax"; no warnings "deprecated";
984200d0
YST
1106$_ = $a = 1;
1107$a !=~ /1/;
1108$a !=~ m#1#;
1109$a !=~/1/;
1110$a !=~ ?/?;
decca21c
YST
1111$a !=~ y/1//;
1112$a !=~ tr/1//;
1113$a !=~ s/1//;
984200d0
YST
1114$a != ~/1/;
1115no warnings "syntax";
1116$a !=~ /1/;
1117$a !=~ m#1#;
1118$a !=~/1/;
1119$a !=~ ?/?;
decca21c
YST
1120$a !=~ y/1//;
1121$a !=~ tr/1//;
1122$a !=~ s/1//;
984200d0
YST
1123EXPECT
1124!=~ should be !~ at - line 4.
1125!=~ should be !~ at - line 5.
1126!=~ should be !~ at - line 6.
1127!=~ should be !~ at - line 7.
decca21c
YST
1128!=~ should be !~ at - line 8.
1129!=~ should be !~ at - line 9.
1130!=~ should be !~ at - line 10.
1108974d
RGS
1131########
1132# toke.c
1133our $foo :unique;
8e5dadda
NC
1134sub pam :locked;
1135sub glipp :locked {
1136}
1137sub whack_eth ($) : locked {
1138}
d1d15184 1139no warnings 'deprecated';
1108974d 1140our $bar :unique;
8e5dadda
NC
1141sub zapeth :locked;
1142sub ker_plop :locked {
1143}
1144sub swa_a_p ($) : locked {
1145}
1108974d 1146EXPECT
d1d15184
NC
1147Use of :unique is deprecated at - line 2.
1148Use of :locked is deprecated at - line 3.
1149Use of :locked is deprecated at - line 4.
1150Use of :locked is deprecated at - line 6.
9e8d7757
RB
1151########
1152# toke.c
e7d0b801 1153use warnings "syntax"; use feature 'lexical_subs';
9e8d7757
RB
1154sub proto_after_array(@$);
1155sub proto_after_arref(\@$);
1156sub proto_after_arref2(\[@$]);
1157sub proto_after_arref3(\[@$]_);
1158sub proto_after_hash(%$);
1159sub proto_after_hashref(\%$);
1160sub proto_after_hashref2(\[%$]);
1161sub underscore_last_pos($_);
1162sub underscore2($_;$);
1163sub underscore_fail($_$);
1164sub underscore_after_at(@_);
689aac7b
FC
1165our sub hour (@$);
1166my sub migh (@$);
e7d0b801 1167use feature 'state';
689aac7b
FC
1168state sub estate (@$);
1169package other;
1170sub hour (@$);
1171sub migh (@$);
1172sub estate (@$);
9e8d7757
RB
1173no warnings "syntax";
1174sub proto_after_array(@$);
1175sub proto_after_hash(%$);
1176sub underscore_fail($_$);
1177EXPECT
1178Prototype after '@' for main::proto_after_array : @$ at - line 3.
1179Prototype after '%' for main::proto_after_hash : %$ at - line 7.
aef2a98a 1180Illegal character after '_' in prototype for main::underscore_fail : $_$ at - line 12.
9e8d7757 1181Prototype after '@' for main::underscore_after_at : @_ at - line 13.
64fbf0dd 1182The lexical_subs feature is experimental at - line 14.
689aac7b 1183Prototype after '@' for hour : @$ at - line 14.
64fbf0dd 1184The lexical_subs feature is experimental at - line 15.
689aac7b 1185Prototype after '@' for migh : @$ at - line 15.
64fbf0dd 1186The lexical_subs feature is experimental at - line 17.
689aac7b
FC
1187Prototype after '@' for estate : @$ at - line 17.
1188Prototype after '@' for hour : @$ at - line 19.
1189Prototype after '@' for migh : @$ at - line 20.
1190Prototype after '@' for estate : @$ at - line 21.
77772344
B
1191########
1192# toke.c
1193use warnings "ambiguous";
1194"foo\nn" =~ /^foo$\n/;
1195"foo\nn" =~ /^foo${\}n/;
1196my $foo = qr/^foo$\n/;
1197my $bar = qr/^foo${\}n/;
1198no warnings "ambiguous";
1199"foo\nn" =~ /^foo$\n/;
1200"foo\nn" =~ /^foo${\}n/;
1201my $foo = qr/^foo$\n/;
1202my $bar = qr/^foo${\}n/;
1203EXPECT
1204Possible unintended interpolation of $\ in regex at - line 3.
1205Possible unintended interpolation of $\ in regex at - line 5.
d83f38d8
NC
1206########
1207# toke.c
f0a2b745
KW
1208use warnings 'syntax' ;
1209my $a = "\o";
1210my $a = "\o{";
1211my $a = "\o{}";
1212no warnings 'syntax' ;
1213my $a = "\o";
1214my $a = "\o{";
1215my $a = "\o{}";
1216EXPECT
1217Missing braces on \o{} at - line 3, within string
1218Missing right brace on \o{ at - line 4, within string
1219Number with no digits at - line 5, within string
1220BEGIN not safe after errors--compilation aborted at - line 6.
1221########
1222# toke.c
1223use warnings 'digit' ;
1224my $a = "\o{1238456}";
1225no warnings 'digit' ;
1226my $a = "\o{1238456}";
1227EXPECT
1228Non-octal character '8'. Resolved as "\o{123}" at - line 3.
725a61d7
Z
1229########
1230# toke.c
1231use warnings;
1232my $a = "foo";
1233print $a =~ ?f? ? "yes\n" : "no\n" foreach 0..2;
1234EXPECT
1235Use of ?PATTERN? without explicit operator is deprecated at - line 4.
1236yes
1237no
1238no
17a3df4c
KW
1239########
1240# toke.c
1241use warnings;
1242my $a = "\c{ack}";
1243$a = "\c,";
1244$a = "\c`";
1245no warnings 'syntax';
1246$a = "\c{ack}";
1247$a = "\c,";
1248$a = "\c`";
1249no warnings 'deprecated';
1250EXPECT
1251"\c{" is deprecated and is more clearly written as ";" at - line 3.
1252"\c," is more clearly written simply as "l" at - line 4.
1253"\c`" is more clearly written simply as "\ " at - line 5.
1254"\c{" is deprecated and is more clearly written as ";" at - line 7.
3955e1a9
KW
1255########
1256# toke.c
1257use warnings 'syntax' ;
1258my $a = qr/foo/du;
ff3f26d2 1259$a = qr/foo/lai;
3955e1a9 1260$a = qr/foo/lil;
ff3f26d2
KW
1261$a = qr/foo/aia;
1262$a = qr/foo/aaia;
3955e1a9
KW
1263no warnings 'syntax' ;
1264my $a = qr/foo/du;
1265EXPECT
1266Regexp modifiers "/d" and "/u" are mutually exclusive at - line 3, near "= "
1267Regexp modifiers "/l" and "/a" are mutually exclusive at - line 4, near "= "
1268Regexp modifier "/l" may not appear twice at - line 5, near "= "
ff3f26d2
KW
1269Regexp modifier "/a" may appear a maximum of twice at - line 7, near "= "
1270BEGIN not safe after errors--compilation aborted at - line 8.
ba05d9aa
FC
1271########
1272# toke.c
1273# [perl #4362]
1274eval "print q\xabfoo";
1275print "ok\n" if
1276 $@ =~ /Can't find string terminator "\xab" anywhere before EOF/;
1277EXPECT
1278ok
5c66c3dd
BF
1279########
1280# toke.c
1281use utf8;
1282use open qw( :utf8 :std );
1283use warnings 'ambiguous' ;
1284sub frèd {}
1285$a = ${frèd} ;
1286no warnings 'ambiguous' ;
1287$a = ${frèd} ;
1288EXPECT
1289Ambiguous use of ${frèd} resolved to $frèd at - line 6.
1290########
1291# toke.c
1292use utf8;
1293use open qw( :utf8 :std );
1294use warnings 'ambiguous' ;
1295sub f렏 {}
1296$a = ${f렏} ;
1297no warnings 'ambiguous' ;
1298$a = ${f렏} ;
1299EXPECT
1300Ambiguous use of ${f렏} resolved to $f렏 at - line 6.
3773592b
BF
1301########
1302# toke.c
1303use utf8;
1304use open qw( :utf8 :std );
1305use warnings;
1306CORE::렏;
1307EXPECT
1308CORE::렏 is not a keyword at - line 5.
5dc13276
MH
1309########
1310# toke.c
1311# [perl #16249]
1312print '';
1313eval this_method_is_fake ();
1314EXPECT
1315Undefined subroutine &main::this_method_is_fake called at - line 4.
a71a1afb
FC
1316########
1317# toke.c
1318# [perl #107002] Erroneous ambiguity warnings
1319sub { # do not actually call require
1320 require a::b . 1; # These used to produce erroneous
1321 require a::b + 1; # ambiguity warnings.
1322}
1323EXPECT
4d68ffa0
KW
1324########
1325# toke.c
8fb629db 1326# [perl #113094]
4d68ffa0
KW
1327print "aa" =~ m{^a\{1,2\}$}, "\n";
1328print "aa" =~ m{^a\x\{61\}$}, "\n";
1329print "aa" =~ m{^a{1,2}$}, "\n";
1330print "aq" =~ m[^a\[a-z\]$], "\n";
1331print "aq" =~ m(^a\(q\)$), "\n";
1332no warnings 'deprecated';
1333print "aa" =~ m{^a\{1,2\}$}, "\n";
1334print "aa" =~ m{^a\x\{61\}$}, "\n";
1335print "aq" =~ m[^a\[a-z\]$], "\n";
1336print "aq" =~ m(^a\(q\)$), "\n";
1337EXPECT
1338Useless use of '\'; doesn't escape metacharacter '{' at - line 3.
1339Useless use of '\'; doesn't escape metacharacter '{' at - line 4.
1340Useless use of '\'; doesn't escape metacharacter '[' at - line 6.
1341Useless use of '\'; doesn't escape metacharacter '(' at - line 7.
13421
13431
13441
13451
1346q
13471
13481
13491
1350q