in reply to renaming files...

...because in your inner loop $TEMP and $TEMP1 have the same value.

You may want to try it like this:

#!/usr/bin/perl -w use strict; my $dir="."; opendir CONCEPT, $dir || die "no such dir"; while (my $temp = readdir(CONCEPT)){ if ($temp =~ /^(A-\d+-\d+)/) { rename $temp, $1 or die "error $! renaming $temp to $1"; } } closedir CONCEPT;