Skip navigation.
Your source for Perl tips, howto's, faq and tutorials
( categories: )

Use the unlink function. You can specify either a single file or a list of files to delete. Here are some examples:

#remove a single file
unlink "file.old";
#remove a list of files
@file_list = ( "file1.txt¨, "file2.txt", "last.file" );
unlink @file_list;
#remove all files ended in .bak
unlink <*.bak>;

- unlink does not remove directories, use rmdir instead