I'm not sure why, but it seems that nobody has pointed out that you would have a much easier time with this if you let Perl tell you why it fails. Change your rename line to: rename ($file, $temp) or warn "Could not rename $file to $temp: $!\n"; Perl can tell you this stuff, make sure you take advantage of it. raterwil@ucla.edu (Robert Terwilliger) wrote: >Hi people. I am trying to remove the '.out' suffix from each file in my >directory. Here is my code: > >opendir(DIR, ':::healthcare.ucla.edu:pls:') or die 'cannot open directory'; >@files = readdir(DIR); >closedir(DIR); > >foreach $file (@files) >{ > if ($file =~ m/.out/) > { > ($temp = $file) =~ s/.out//; > rename ($file, $temp) or warn "Could not rename $file to $temp\n"; > } >} > >########################### > >This is MacPerl console output: > ># Could not rename acne.htm.out to acne.htm ># Could not rename ageskin.htm.out to ageskin.htm ># Could not rename arthritis.htm.out to arthritis.htm ># Could not rename asthma.htm.out to asthma.htm > >'rename' is returning 0 and not 1. How do I get this to work? > >-- >Robert Terwilliger, M.S. >raterwil@ucla.edu > > > ># ===== Want to unsubscribe from this list? ># ===== Send mail with body "unsubscribe" to macperl-request@macperl.org > ------------------- ------------------- Ken Williams Last Bastion of Euclidity ken@forum.swarthmore.edu The Math Forum # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org