Sorry I didn't show any code. Is just a few lines long so I didn't think it was necessary.
Example:
system ("vp -e " . $ENV{'VREL'});
rm /home/$ENV{'verl'};
the problem is my program is dying when the user closes my vp program. I never get to the remove directory. I tried printing for debugging purposes also but my program is dying on that line.