in reply to Pattern Matching and replacement

Usually writing regex's for HTML is a bad idea. In any case, you should be able to modify this to suit your needs.
my $newvalue = "foobar"; foreach (<DATA>) { s/(<input .+? value=["']).*?(["'].*?>)/$1$newvalue$2/; print; } __DATA__ <input type="text" value=""> <input type="password" name="moo" value="fish" /> <input type="text" value=''/>
Note that it assumes the tag already has a value attribute (either set or empty).