Commit | Line | Data |
---|---|---|
1 | #!./perl | |
2 | ||
3 | # check to see if subroutine declarations work everywhere | |
4 | ||
5 | sub one { | |
6 | print "ok 1\n"; | |
7 | } | |
8 | format one = | |
9 | ok 6 | |
10 | . | |
11 | ||
12 | print "1..9\n"; | |
13 | ||
14 | one(); | |
15 | two(); | |
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 | } | |
29 | three(); | |
30 | } | |
31 | ||
32 | four(); | |
33 | five(); | |
34 | $~ = 'one'; | |
35 | write; | |
36 | $~ = 'two'; | |
37 | $foo = "ok 7"; | |
38 | write; | |
39 | $~ = 'three'; | |
40 | write; | |
41 | ||
42 | format three = | |
43 | ok 8 | |
44 | . | |
45 | ||
46 | if ($x eq $x) { | |
47 | goto quux; | |
48 | } | |
49 | ||
50 | print "not ok 9\n"; | |
51 | exit 1; | |
52 | ||
53 | sub four { | |
54 | print "ok 4\n"; | |
55 | } | |
56 | ||
57 | quux: | |
58 | sub five { | |
59 | print "ok 5\n"; | |
60 | } | |
61 | print "ok 9\n"; |