Please see Re: Evaluating $1 construct in literal replacement expression to begin your journey.
Update: Or am I reading more into your question than you intend? Maybe just:
See eval. ("After parsing a file and extracting the following line..." Note that using string eval in this way is a potentially dangerous operation.)c:\@Work\Perl\monks>perl -wMstrict -le "my $string = 'hello $1'; ;; if ('good morning all' =~ /good morning (\w+)/) { my $evaled_string = eval qq{ qq{$string} }; print qq{>$evaled_string<}; } " >hello all<
Give a man a fish: <%-{-{-{-<
In reply to Re: Extracting regex from string
by AnomalousMonk
in thread Extracting regex from string
by mleshin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |