in reply to FIle name help!

From reading your description, it sounds like you have filename1234.pdf and you need to change it to filename1234.txt, is that right? Why not:

$name =~ s/pdf$/txt/;