Programming Perl

Programming PerlSearch this book
Previous: 3.2.117 readdirChapter 3
Functions
Next: 3.2.119 recv
 

3.2.118 readlink

readlink EXPR

This function returns the name of a file pointed to by a symbolic link. EXPR should evaluate to a filename, the last component of which is a symbolic link. If it is not a symbolic link, or if symbolic links are not implemented, or if some system error occurs, the undefined value is returned, and you should check the error code in $!. If EXPR is omitted, the function uses $_.

Be aware that the returned symlink may be relative to the location you specified. For instance, you may say:

readlink "/usr/local/src/express/yourself.h"

and readlink might return:

../express.1.23/includes/yourself.h

which is not directly usable as a filename unless your current directory happens to be /usr/local/src/express.


Previous: 3.2.117 readdirProgramming PerlNext: 3.2.119 recv
3.2.117 readdirBook Index3.2.119 recv