File::Remove is a Perl module to remove files and directories.
use File::Remove qw(remove);
# removes (without recursion) several files
remove qw( *.c *.pl );
# removes (with recursion) several directories
remove 1, qw( directory1 directory2 );
# removes (with recursion) several files and directories
remove 1, qw( file1 file2 directory1 *~ );
# trashes (with support for undeleting later) several files
trash qw( *~ );
File::Remove::remove removes files and directories. It acts like /bin/rm, for the most part. Although unlink can be given a list of files, it will not remove directories; this module remedies that. It also accepts wildcards, * and ?, as arguments for filenames.
File::Remove::trash accepts the same arguments as remove, with the addition of an optional, infrequently used "other platforms" hashref.