#!/usr/bin/perl -w use strict; my $dir = "c:/Xwords"; my $from = '.puz'; my $to = 'A.puz'; while (<$dir*$from>) { my ($old,$new); $old = $new = $_; $new =~ s/$from$/$to/; rename $old, $new; } print "Files renamed !";