--- name: link status: documented runtime: pp source: src/runtime/pp/filemod.rs --- ```{index} single: link; Perl built-in (pp runtime) ``` # link ## Synopsis ```perl link $oldfile, $newfile or die "Cannot link: $!"; link '/data/original', '/data/hardlink'; ``` ## Description Creates a hard link to an existing file. Creates a new directory entry NEWFILE that refers to the same inode as OLDFILE. Both paths must be on the same filesystem. The link count of the file is incremented. Uses `std::fs::hard_link`. Returns 1 on success, 0 on failure (and sets `$!`). ## See also symlink, unlink, rename