On 2/25/07, Daniel Kasak <[EMAIL PROTECTED]> wrote:

How do I, inside Perl, get the path of the home directory?

  my $user_home_dir = $ENV{HOME} || (getpwuid($<))[7];  # maybe?

You could also try chdir with no arguments and see where it takes you.

I assume if I can do this, it will only work under Linux / Unix?

Systems that run Perl may not have the concept a home directory, but
you could default to the current working directory, say, if $ENV{HOME}
is unset.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to