Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL link Function
Syntax
Definition and Usage
Creates a new file name, NEWFILE, linked to the file OLDFILE. The function creates a
hard link; if you want a symbolic link, use the symlink function.
Return Value
Example
Try out following example: This will create new file using existing file.
#!/usr/bin/perl
$existing_file = "/uer/home/test1";
$new_file = "/usr/home/test2";
$retval = link $existing_file, $new_file ;
if( $retval == 1 ){
print"Link created successfully\n";
}else{
print"Error in creating link $!\n";
}
|
|

|
|
|