http://qs321.pair.com?node_id=26841


in reply to renaming files...

On the line
if ($TEMP1 =~ /(A-[0-9]+-[0-9]+)/) {
You want to take the output of the pattern match. $TEMP1 isn't being altered at all, it's just being matched against. The result of the pattern match is left in $1. Try this:
$DIR="."; opendir CONCEPT, $DIR || die "no such dir"; while ($TEMP = readdir(CONCEPT)) { if ($TEMP =~ /(A-[0-9]+-[0-9]+)/) { if (rename $TEMP, $1) { print $1; } } }
The code was editted as little as possible. Any stricting, -w'ing, and error checking is left as an excercise to the reader.