[Tutor] perl

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Wed, 24 Jan 2001 00:39:25 -0800 (PST)

On Tue, 23 Jan 2001, Matthias Hager wrote:

> I know this is off the subject of Python, but this is the only place I could think of to come to. But here's a Perl Q or two.

> 1. How can you get the current location of a user in *nix? Where they
> are at directory wise. And how can you change their location to a
> different directory? I want to kind of emulate the cd and evrything
> functions of bash.

Don't know too much about Perl, but I know that perldoc is a good
friend... *grin*

Try "perldoc -f chdir", which should give you enough information to change
directories pretty easily.  About finding the current directory... hmmm...
well, the quick fix is to do:

    $dirname = `pwd`

if you're on a UNIX; otherwise, I'm not quite sure; I'm a Perl newbie
myself.  You might want to check with "perldoc perlfunc" and see if
there's something useful there.  Otherwise, check either the Camel book or
talk to some people on comp.lang.perl.

Good luck!