Web | This Site

Perl Home
PERL Functions
© 2011 TutorialsPoint.COM

| Home |  | References |  | About TP |  | Advertising

# PERL link Function

## Syntax

link OLDFILE,NEWFILE

## 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

0 on failure and 1 on success

## 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";
    }

Advertisement

Online Image Processing

Indian Baby Names