I have a hash which contains a regular expression: the number of matches to be captured in it and variables and their position of match. For example:
my %hash = (
reg_ex => 'Variable1:\s+(.*?)\s+\n\s+Variable2:\s+(.*?)\s+\n',
count => 2,
Variable1 => 1,
Variable2 => 2,
);
I am going to use this regex in some other part of code where I will be just giving say $to_be_matched_variable =~ /$hash{reg_ex}/ and we obtain the required matches here in $1, $2, ...
I need to use the value of the key Variable1, which indicates the number of the match to be used in place where we normally use $1.
I tried giving $.$hash{Variable1} and $,$hash{Variable1}. I am not able to find how to frame something that will be equivalent to $1, $2...