Yes, that'll work. As will
$post{$element} = $1 if $html =~ m/id="$element" name="challenge" value="(.*?)"/;
Unless you expect $element to contain metacharacters, you should use
m/id="\Q$element\E" name="challenge" value="(.*?)"/;
to escape any metacharacters in $html. See quotemeta for more.
In reply to Re^3: Regexp question
by FunkyMonk
in thread Regexp question
by davidov0009
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |