in reply to A memory problem?

You missed paranthesis.

Use if ($temp2 =~ m/^([a-zA-Z]+)$/)

Update:

In your previous post they have(PMs) explained about using paranthesis to store the values in a variable.

Prasad