in reply to Why aren't system() calls working?

I wonder why you are using system() and not Perl's builtin rmdir() function.
$result = rmdir($directory); if ($result) { print "Directory '$directory' removed.\n"; } else { print "Directory '$directory' not removed: $!\n"; }
Or, if you need to do a recursive rm, you can use File::Path's rmtree method.

If your code works from the command line but not via the web server, there must be some difference between the users or the environments. Note that, in order to delete a directory, you must have write access to that directory and its parent directory.