in reply to regular expressions

You want
if ($amourss =~ /^a.+[fg]$/) { }
or
if ($amourss =~ /^a.+(?:f|g)$/) { }
Assuming you're doing a test and not trying to return part of the motif. EDIT: The example given above is inefficient because it uses (f|g) instead of (?:f|g), requiring the regex to return this part of the match as $1 when not needed.