Broken directory?

I have an odd problem which I suspect is of my own making. My /usr/bin directory has within it a single directory named X11. What is odd is that directory in turn has an another X11 directory to a depth of 41. I am able to use “cd” to position to the X11 directories, but, for some reason, I am unable to position to any of them using a simple Perl script that codes -
chdir “/usr/bin/X11” || die “Failed to chdir to X11 $!”;
chomp($currdir = pwd);
print "Current directory = $currdir
The result here is “Current directory = /usr/bin”.
I would certainly appreciate any suggestions.

I am running Suse 11.1 on a Dell PC. Suse is 64 bit. Perl is v5.10.0 built for x86_64-linux-thread-multi

A look at the directory with ls -l would have revealed the reason instantly:

lrwxrwxrwx 1 root root 1 2009-12-21 17:23 /usr/bin/X11 -> .

/usr/bin/X11 is just a symlink to /usr/bin. So, if you want to deal with this problem in your script, it has to be more comprehensive. Either you do the chdir and accept the result, or if you wish to prohibit symlinks you have to check that it’s not a symlink first. Depends on what you are trying to do.

Ok, I see now. I guess I need to exclude symlinks in my script - !(-l “$dirent”).
Thanks for your answer,