This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix SEGV with eval("package Foo {")
[perl5.git] / t / comp / decl.t
1 #!./perl
2
3 # check to see if subroutine declarations work everwhere
4
5 sub one {
6     print "ok 1\n";
7 }
8 format one =
9 ok 5
10 .
11
12 print "1..7\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 $~ = 'one';
34 write;
35 $~ = 'two';
36 $foo = "ok 6";
37 write;
38 $~ = 'three';
39 write;
40
41 format three =
42 ok 7
43 .
44
45 sub four {
46     print "ok 4\n";
47 }