in reply to why this code doesnt work?

[ I moved your post to Seekers of Perl Wisdom. PerlMonks Discussion is for discussion about PerlMonks. ]

[ Your post is hard to read. Please use <p> at the start of paragraphs and <c>...</c> around computer text (code, data, output, etc). ]

pdw should be pwd. See also: Cwd.