Perl - How to empty a directory?

Hi Guys,

i'm writing a perl script which whenever runs, should empty 3 pre-decided directories as first step and then the script has the logic to parse some other directories and copy the files inside those directories into these 3 directories. I've the logic already developed, just need to know how to Empty the directories without deleting them.

Thanks in advance.

---------- Post updated at 07:36 PM ---------- Previous update was at 07:20 PM ----------

i've come up with this -

system("cd /root/abc/testing/CA; rm *.*");

rm command scares me a bit. Is this safe or is there anything more simpler and safe?

Hey!! Why can't you take a look into the unlink function in perl. Cheers, Ranga:-)

*.* is a DOS thing. * does the job by itself.

If you're embedding shell code in perl, chances are you should be writing a shell script.