[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Why do I get an error using 'rename'?



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