in reply to knowing the current directory

The special variable $0 contains the full path of the script including the script name. If you knew the name of the script then to work out the directory the script is in you could use something like:
($cur_dir = $0) =~ s/$name_of_script//;
Rob