in reply to Re^2: extracting email attachments
in thread extracting email attachments

Figured it out. This is what I added before I open the file for writting.
$attname[$x]=~ s/[^A-Za-z0-9\-\.]//g;