Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!princeton!phoenix.Princeton.EDU!subbarao From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao) Newsgroups: comp.lang.perl Subject: Re: Perl beginner Message-ID: Date: 29 May 91 12:34:48 GMT References: Sender: news@idunno.Princeton.EDU Reply-To: subbarao@phoenix.Princeton.EDU (Kartik Subbarao) Organization: American Chemical Society Lines: 34 In article bobg+@andrew.cmu.edu (Robert Steven Glickstein) writes: >I'm a Perl beginner, but I'm amazed by how quickly I've picked up the >language and how quickly I've been able to write really complex >utilities. To an experienced C programmer like myself, Perl came very >naturally and it is now my prototype/utility language of choice. OK, >enough hype. :-) > >It seems that Perl ought to have a built-in getwd command, but it >doesn't. By "built-in", do you mean that it should getcwd() every time it starts up and save that as a $something variable? There's really no need to do so, if you don't care about your current working directory. SOMEONE has to do the getcwd() call -- you don't get it for free. 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). -Kartik -- internet% whoami subbarao@phoenix.Princeton.EDU -| Internet kartik@silvertone.Princeton.EDU (NeXT mail) SUBBARAO@PUCC.BITNET - Bitnet