Print symbolic links.
#!/usr/local/bin/perl $dir = "/u/Tom"; opendir(MYDIR, $dir); while ($name = readdir(MYDIR)) { if (-l $dir . "/" . $name) { print ("$name is linked to "); print (readlink($dir . "/". $name) . "\n"); } } closedir(MYDIR);
1. | The readlink function returns the value of the symbolic link | ||
2. | readlink reads the link and returns the true file name that a link points to |