@array = glob(*.old); while(<@array>) { $newext = $_; $newext =~ s/old/new/; rename($_, $newext); }