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