in reply to How to use a regex to parse html form tags

Well, whether or not your data and your intended edit are really as simple as you think they should be, some of your code gives me the impression that you are missing a few details about syntax involved with regular expressions. In particular:
$orgtext = Whey; # this one right here $newtext = Popcorn;
The above works. I reduced it to it's simplest form as a sanity check. Then I tried:
$orgtext = /[Ww]hey/; # this one right here $newtext = Popcorn;
The second statement for "$orgtext" is equivalent to:
$orgtext = ( $_ =~ /[Ww]hey/ );
If nothing was ever assigned to $_ at the time your second $orgtext statement executed, you get the warning because perl is doing a regex match on $_, and $_ is undefined because no value has been assigned to it.

Maybe that second example should have been something like this?

$orgtext = qr/[Wwhey]/;

As for what you "eventually want to try":

$orgtext = /<form[.*]?*\/form>/; # this one right here $newtext = bloc +k;

That assignment to $orgtext has not only the same problem cited above (use "qr/.../" instead?), but also problems with improper use of the square brackets, period, question mark and asterisks. I think what you intended was something like this:

$orgtext = qr/<form.*?\/form>/sg; # s is needed so that "." matches ne +wline

But as others have pointed out, an HTML parsing module, once you get the hang of it, is probably a better approach.

Next there's this in your "base code":

$intext =~ s/$orgtext/$newtext/ms; # the ms is for coping correctly with newlines (that can easily appear + in a binary). ... # replaces ALL occurrences of orgtext with newtext and places the numb +er of occurences in $count
The comment about "that can easily appear in a binary" makes no sense, and the use of "m" on that substitution is actually pointless -- it would be relevant if you were anchoring the regex match with "^" or "$", because "m" alters the behavior of those anchors, but you're not using them. (The "whey" example doesn't use "." either, so the "s" is pointless as well in that case, but it's harmless, and I know you eventually expected to use ".")

And then, based on your closing comment (which refers to a "$count" variable that doesn't appear anywhere), it looks like you should have used the "g" modifier on that substitution, so that all occurrences of "$orgtext" would be changed to "$newtext".