in reply to regular expressions

Appending the matched text like that won't work, you need to do it in two steps:
/<regex>/; $amourss.=$1;
This is what I'm guessing you want to do with your regular expression(with comments):
/^ # Match the start of the string a # Single occurrence of the character a (.+) # Grab one or more other characters # and put into $1 [fg] # a single character, either "f" or "g" $ # match the end of the string /x # x modifier to allow comments in regex
So your complete code would look something like this:
/^a(.+)[fg]$/ $amourss.=$1;