$ perl ./scopeupper.pl
START at ./scopeupper.pl line 30.
foo: start at ./scopeupper.pl line 8.
bar: start at ./scopeupper.pl line 14.
FUNC: X at ./scopeupper.pl line 24.
bar: end at ./scopeupper.pl line 26.
REAP: Y at ./scopeupper.pl line 19.
foo: end at ./scopeupper.pl line 10.
END at ./scopeupper.pl line 32.

$ perl ./scopeupper.pl
START at ./scopeupper.pl line 30.
foo: start at ./scopeupper.pl line 8.
bar: start at ./scopeupper.pl line 14.
FUNC: X at ./scopeupper.pl line 24.
bar: end at ./scopeupper.pl line 26.
foo: end at ./scopeupper.pl line 10.
END at ./scopeupper.pl line 32.
REAP: main at ./scopeupper.pl line 19.

$ perl ./scopeupper.pl
START at ./scopeupper.pl line 30.
foo: start at ./scopeupper.pl line 8.
bar: start at ./scopeupper.pl line 14.
FUNC: X at ./scopeupper.pl line 24.
bar: end at ./scopeupper.pl line 26.
REAP: Y at ./scopeupper.pl line 19.
foo: end at ./scopeupper.pl line 10.
END at ./scopeupper.pl line 32.

HERE を UP に変えると

$ perl ./scopeupper.pl
START at ./scopeupper.pl line 30.
foo: start at ./scopeupper.pl line 8.
bar: start at ./scopeupper.pl line 14.
FUNC: X at ./scopeupper.pl line 24.
bar: end at ./scopeupper.pl line 26.
foo: end at ./scopeupper.pl line 10.
REAP: main at ./scopeupper.pl line 19.
END at ./scopeupper.pl line 32.

HERE を UP 1 に変えると

$ perl ./scopeupper.pl
START at ./scopeupper.pl line 30.
foo: start at ./scopeupper.pl line 8.
bar: start at ./scopeupper.pl line 14.
FUNC: X at ./scopeupper.pl line 24.
bar: end at ./scopeupper.pl line 26.
foo: end at ./scopeupper.pl line 10.
END at ./scopeupper.pl line 32.
REAP: main at ./scopeupper.pl line 19.

$ perl ./scopeupper.pl
START at ./scopeupper.pl line 30.
foo: start at ./scopeupper.pl line 8.
bar: start at ./scopeupper.pl line 14.
FUNC: X at ./scopeupper.pl line 24.
bar: end at ./scopeupper.pl line 26.
REAP: Y at ./scopeupper.pl line 19.
foo: end at ./scopeupper.pl line 10.
END at ./scopeupper.pl line 32.

$ perl ./scopeupper.pl
START at ./scopeupper.pl line 30.
foo: start at ./scopeupper.pl line 8.
bar: start at ./scopeupper.pl line 14.
FUNC: X at ./scopeupper.pl line 24.
bar: end at ./scopeupper.pl line 26.
foo: end at ./scopeupper.pl line 10.
REAP: main at ./scopeupper.pl line 19.
END at ./scopeupper.pl line 32.

$ perl ./scopeupper.pl
START at ./scopeupper.pl line 30.
foo: start at ./scopeupper.pl line 8.
bar: start at ./scopeupper.pl line 14.
FUNC: X at ./scopeupper.pl line 24.
bar: end at ./scopeupper.pl line 26.
foo: end at ./scopeupper.pl line 10.
END at ./scopeupper.pl line 32.
REAP: main at ./scopeupper.pl line 19.