xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/comp/decl.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!./perl
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gate# $RCSfile: decl.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:19 $
4*0Sstevel@tonic-gate
5*0Sstevel@tonic-gate# check to see if subroutine declarations work everwhere
6*0Sstevel@tonic-gate
7*0Sstevel@tonic-gatesub one {
8*0Sstevel@tonic-gate    print "ok 1\n";
9*0Sstevel@tonic-gate}
10*0Sstevel@tonic-gateformat one =
11*0Sstevel@tonic-gateok 5
12*0Sstevel@tonic-gate.
13*0Sstevel@tonic-gate
14*0Sstevel@tonic-gateprint "1..7\n";
15*0Sstevel@tonic-gate
16*0Sstevel@tonic-gatedo one();
17*0Sstevel@tonic-gatedo two();
18*0Sstevel@tonic-gate
19*0Sstevel@tonic-gatesub two {
20*0Sstevel@tonic-gate    print "ok 2\n";
21*0Sstevel@tonic-gate}
22*0Sstevel@tonic-gateformat two =
23*0Sstevel@tonic-gate@<<<
24*0Sstevel@tonic-gate$foo
25*0Sstevel@tonic-gate.
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gateif ($x eq $x) {
28*0Sstevel@tonic-gate    sub three {
29*0Sstevel@tonic-gate	print "ok 3\n";
30*0Sstevel@tonic-gate    }
31*0Sstevel@tonic-gate    do three();
32*0Sstevel@tonic-gate}
33*0Sstevel@tonic-gate
34*0Sstevel@tonic-gatedo four();
35*0Sstevel@tonic-gate$~ = 'one';
36*0Sstevel@tonic-gatewrite;
37*0Sstevel@tonic-gate$~ = 'two';
38*0Sstevel@tonic-gate$foo = "ok 6";
39*0Sstevel@tonic-gatewrite;
40*0Sstevel@tonic-gate$~ = 'three';
41*0Sstevel@tonic-gatewrite;
42*0Sstevel@tonic-gate
43*0Sstevel@tonic-gateformat three =
44*0Sstevel@tonic-gateok 7
45*0Sstevel@tonic-gate.
46*0Sstevel@tonic-gate
47*0Sstevel@tonic-gatesub four {
48*0Sstevel@tonic-gate    print "ok 4\n";
49*0Sstevel@tonic-gate}
50