Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!mauxci!eci386!jmm From: jmm@eci386.uucp (John Macdonald) Newsgroups: comp.lang.perl Subject: Re: Perl beginner Message-ID: <1991May31.161535.2023@eci386.uucp> Date: 31 May 91 16:15:35 GMT References: Reply-To: jmm@eci386.UUCP (John Macdonald) Organization: Elegant Communications Inc. Lines: 27 In article subbarao@phoenix.Princeton.EDU (Kartik Subbarao) writes: |In article bobg+@andrew.cmu.edu (Robert Steven Glickstein) writes: | |Is it the case that the only way to find out the current |>working directory is to do |> |> $cwd = `/bin/pwd`; |> chop $cwd; | |In the case that your shell sets a CWD or PWD environment variable, then you |can access it in perl by: | |$cwd = $ENV{'CWD'} (or PWD, or whatever). Be careful here - this only works if you will never have the Perl script run from a program or script written for an interpreter that does not keep $CWD correct. Tools should not be written to depend on being run in a very specialized context that can't be validated, unless you are absolutely sure that the will never be run from a different context (or evolve into something that will be run from a different context - there are many "temporary" programs around whose ages are measured in decades). -- Usenet is [like] the group of people who visit the | John Macdonald park on a Sunday afternoon. [...] luckily, most of | jmm@eci386 the people are staying on the paths and not pissing | on the flowers - Gene Spafford