カレントディレクトリ名をPerlモジュールのCwd::cwdで生成
PerlモジュールのCwdを使用して、cwd関数でカレントディレクトリ名を出力しました。)
#!/opt/local/bin/perl
use strict;
use warnings;
use utf8;
use Cwd qw(cwd);
print "Content-type: text/plan; charset=utf-8\n\n";
print cwd(".");
exit;
/Users/UserName/Documents/workspace/cgi-bin
サンプルコードと出力結果です。プログラムのファイルが置かれているカレントディレクトリ名がcwd関数で出力されました。