$attach_name =~ s/[^\w\s\-\.]/_/; $safe_attach_name = $1;
However, this isn't populating $safe_attach_name with anything. What am I doing wrong?
You're using a variable which has not had anything assigned to it. The capture variable $1 is only assigned something if you put parentheses around the bit to be captured, like 's/([^\w\s\-\.])/_/', where $1 then has the *original* left-hand match of that substitution in it. What you are doing with s/// is *substituting*, though. And you are doing the substitution in place, i.e. you are changing your original variable. Try printing $attach_name in your code above and you will see that the $attach_name variable has been changed.
Have a look at the documentation you can find by executing 'perldoc perlretut' from the command line. That's a nice Perl regular expressions tutorial that should clear up a lot of the confusion about regexen.
Good Luck,
Damon
--
Damon Allen DAVISON Romanisches Seminar Universität zu Köln
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>