in reply to Text manipulation

my $1st = $1;

The errors you are getting are from these variable declarations - user defiend variables should start with a letter or underscore, to avoid conflicts with predefined variables. If you name them "$_1st, $_2nd" youll avoid the error.

However there is no need to assign the match variables to temporary variables in your case.

qq