With that code, all you're doing is creating a string variable with a value of "rm file.dat" and then doing nothing with it. You've got at least 2 options for deleting files.
$del = "rm file.dat";
exec($del);
or
unlink("file.dat");
You may need to specify the full path to the file. delete() is an alias of unlink() and will work as well. In all cases, you must make sure that your web server usera account has the appropriate permissions to delete files from the folder in question. HTH.
Cheers,
Geoff A. Virgo