File: chdir-example.pl

package info (click to toggle)
libfile-chdir-perl 0.1008-1.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 224 kB
  • sloc: makefile: 549; perl: 482
file content (21 lines) | stat: -rw-r--r-- 230 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use strict;
use warnings;
use File::chdir;

mkdir "foo";

$CWD = "foo"; # now in foo/

mkdir "bar";

{
    local $CWD = "bar";  # now in foo/bar/
}

# back to foo
rmdir "bar";

pop @CWD; # now in original directory

rmdir "foo";