Copyright © tutorialspoint.com

# PERL unlink Function

## Syntax

unlink LIST unlink

## Definition and Usage

Deletes the files specified by LIST, or the file specified by $_ otherwise. Be careful while using this function because there is no recovering once a file gets deleted.

## Return Value

- Number of files deleted.

## Example

Create two files t1.txt and t2.txt in /tmp directory and then use the following program to delete these two files.

    #!/usr/bin/perl -w

    unlink( "/tmp/t1.txt", "/tmp/t2.txt" );

It will produce following results:

    Both the files t1.txt and t2.txt will be deleted from /tmp.

Copyright © tutorialspoint.com