Commit | Line | Data |
---|---|---|
8d063cd8 LW |
1 | #!./perl |
2 | ||
93f09d7b | 3 | # check to see if subroutine declarations work everywhere |
8d063cd8 LW |
4 | |
5 | sub one { | |
6 | print "ok 1\n"; | |
7 | } | |
8 | format one = | |
5f211341 | 9 | ok 6 |
8d063cd8 LW |
10 | . |
11 | ||
5f211341 | 12 | print "1..9\n"; |
8d063cd8 | 13 | |
065f14eb NC |
14 | one(); |
15 | two(); | |
8d063cd8 LW |
16 | |
17 | sub two { | |
18 | print "ok 2\n"; | |
19 | } | |
20 | format two = | |
21 | @<<< | |
22 | $foo | |
23 | . | |
24 | ||
25 | if ($x eq $x) { | |
26 | sub three { | |
27 | print "ok 3\n"; | |
28 | } | |
065f14eb | 29 | three(); |
8d063cd8 LW |
30 | } |
31 | ||
065f14eb | 32 | four(); |
5f211341 | 33 | five(); |
8d063cd8 LW |
34 | $~ = 'one'; |
35 | write; | |
36 | $~ = 'two'; | |
5f211341 | 37 | $foo = "ok 7"; |
8d063cd8 LW |
38 | write; |
39 | $~ = 'three'; | |
40 | write; | |
41 | ||
42 | format three = | |
5f211341 | 43 | ok 8 |
8d063cd8 LW |
44 | . |
45 | ||
5f211341 Z |
46 | if ($x eq $x) { |
47 | goto quux; | |
48 | } | |
49 | ||
50 | print "not ok 9\n"; | |
51 | exit 1; | |
52 | ||
8d063cd8 LW |
53 | sub four { |
54 | print "ok 4\n"; | |
55 | } | |
5f211341 Z |
56 | |
57 | quux: | |
58 | sub five { | |
59 | print "ok 5\n"; | |
60 | } | |
61 | print "ok 9\n"; |