On Fri, Apr 20, 2001 at 06:08:47PM -0400, McCormick, Rob E wrote:
[snip]

One thing I find confusing about your example is that you're
using the same variable ($msds_files) twice, for different things.
How about something like:

#!c:/perl/bin/perl -w
use strict;

my $dir = "c:/winnt/profiles/myprofile/desktop/perl/test/";
opendir(MSDS,$dir) or die "can't opendir '$dir': $!";

while (defined(my $file = readdir(MSDS)))
{
    next if $file =~ /^\.\.?$/;   # skip ".", ".."
        next if $file =~ /\.pl$/;     # don't want to rename Perl script
    my $newfile = $file . ".txt"; # or whatever
    print "'$file' => '$newfile'\n";
#   rename($file, $newname)
#       or warn "Couldn't rename '$file' => '$newfile': $!\n";
}

closedir(MSDS);

Be sure to only turn on the 'rename' statement when you're
confident in it...

-- 
and how does it feel like/to let forever be

Reply via email to