Thursday, September 16, 2010

unlink in Perl: to delete the file

Unlink : this command permanently deletes a list of file from system.
Return: returns number of files successfully deleted. on failure sets value of "$!"  and returns false. It will not tell you the name of file which it couldn't delete.
Do not try deleting directory instead use rmdir command.

unlink("file1.txt");
unlink "a.txt", "b.txt";
unlink @list;
unlink glob "*.bak";

No comments:

Post a Comment