Multiple Files deletion in perl

Hello Friends,

I want to delete all the "*.trg" files in a directory but i don't want to do it by

system("rm -r *.trg");

Can i do it thru unlink or by any other mean

Thanks,
Pulkit

if no subdirectories are involved:

unlink glob('path/to/folder/*.trg');

or if you are in the directory:

unlink glob('*.trg');

if you have to drill down through subdirectories you can use File::Find to find them all and unlink to delete them.