File: test17-goto.p

package info (click to toggle)
libdevel-nytprof-perl 5.06%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,396 kB
  • ctags: 1,413
  • sloc: perl: 4,905; ansic: 101; sh: 54; makefile: 17
file content (35 lines) | stat: -rw-r--r-- 373 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# test various forms of goto

# simple in-line goto

goto main_label;
die "should not get here";
main_label:;

sub other { } # stub for checking sub caller info

# goto &sub

sub origin {
    other();
    goto &destination;
}

sub destination {
    other();
}

origin();

# goto out of a sub

sub bar {
    goto foo_label;
}

sub foo {
    bar();
    foo_label:;
}

foo();