PERL in Win32

How would I remove/delete a file from perl while perl in win32 doesn't have rm.
LVL 1
tanc02Asked:
Who is Participating?
 
jlevieConnect With a Mentor Commented:
The standard programatical way of deleting a file from within a perl script is to "unlink file;". This method is platform independent.
0
 
tanc02Author Commented:
please give me more detail.
I have win98.
0
 
jlevieCommented:
Okay, if I have a perl script and from within that script I wish to remove a file I would have a line of perl code that looks like:

unlink "this-file.dat";

The file name can be a variable as in:

$trash = "C:\temp\tempfile.tmp";
unlink $trash;

Or it can be a list. If list is omitted, it unlinks the file given in $_. The unlink function returns the number of files deleted. Typically, unlink will not remove directories (on Unix you have to be the superuser and invoke perl with the -U option).
0
All Courses

From novice to tech pro — start learning today.