I have stored a piece of string "Strawberry Hill" in a variable. However I am trying to use a regular expression to see if the string matches a particular format. If the string matches I would like to store it in a variable. However nothing gets stored in the variable. I tested the regular expression in the same script outside of the if statement and it worked.
my $address="STRAWBERRY HILL";
if($address=~ m/(\w+\s+\w+)/)
{
my $scheme_name=$1;
}
print " Scheme Name: $scheme_name";