This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
a "replacement" for awk and sed
[perl5.git] / t / op.goto
CommitLineData
8d063cd8
LW
1#!./perl
2
3# $Header: op.goto,v 1.0 87/12/18 13:13:40 root Exp $
4
5print "1..3\n";
6
7while (0) {
8 $foo = 1;
9 label1:
10 $foo = 2;
11 goto label2;
12} continue {
13 $foo = 0;
14 goto label4;
15 label3:
16 $foo = 4;
17 goto label4;
18}
19goto label1;
20
21$foo = 3;
22
23label2:
24print "#1\t:$foo: == 2\n";
25if ($foo == 2) {print "ok 1\n";} else {print "not ok 1\n";}
26goto label3;
27
28label4:
29print "#2\t:$foo: == 4\n";
30if ($foo == 4) {print "ok 2\n";} else {print "not ok 2\n";}
31
32$x = `./perl -e 'goto foo;' 2>&1`;
33print "#3\t/label/ in :$x";
34if ($x =~ /label/) {print "ok 3\n";} else {print "not ok 3\n";}