Use Cwd; my $cwd_var = cwd(); print "My current working directory: $cwd_var\n";