in reply to Re^2: Regexp question
in thread Regexp question

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.