Search for Tips & Tricks

Google
 

Thursday, January 3, 2008

How to delete files in Perl ?

>>> Code >>>>>>

@fileList = (”file1.txt”,”file2.pl”,”file3.java”);

unlink @filelist;

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

The above code will delete files in fileList arry from current directory. If you want to remove files from a specific directory first use “chdir ” to set the present directory and then user unlink.

No comments: