File: chdir-example.pl

package info (click to toggle)
libfile-chdir-perl 0.1008-1.2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 192 kB
  • sloc: perl: 482; makefile: 52
file content (21 lines) | stat: -rw-r--r-- 230 bytes parent folder | download | duplicates (5)
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";