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