in reply to Out of a hole?

You can always pinch the code out of the POSIX module to do this (it uses the Cwd module under Win32, or `pwd` under anything else). You could also do this using an evil hack:

Warning: This really is a very evil hack. And it won't work on non-POSIXish systems...

require 'syscall.ph'; use strict; use Carp; sub cwd () { my $buf = ' ' x 256; $! = 0; my $res = syscall(&SYS_getcwd, $buf, length($buf)) croak "getcwd: $!" if ($res == -1 && $! != 0); $buf =~ /\0.*$//; return $buf; }
This obviously requires the syscall.ph header (and strict and Carp, but you can get rid of them easily). If you really don't want to use that either, you can find out the value returned by SYS_getcwd. This goes beyond evil, by the way, but under Linux (and probably nothing else), this will work:
my $res = syscall(183, $s, length($s));
But it will almost certainly have radically different results on other operating systems!

Of course, if you are using Win32, it may not have getcwd, but it may have an equivalent.

Andrew.