[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: Re: [MacPerl] Searching help



Hi everyone.

Okay, I am sorry about that.  Here is what I want it to do.  I would like 
to replace the <input *> tags with the value that is stored in the %data 
hash.  I get the field name correctly, however the replace does not 
happen.  I think it has to do with the <input> tag part, but I am not 
sure.  I will attach the bit of code with this email again along with a 
small bit of HTML code to search and replace with.

Oh, the %data hash is generated by a data file created by a different 
script.  I have made sure that the right info is in there.

Perl code:

while ($done ne "true") {
     $done = "true";
     if ($TheHTML =~ m#(<input.*?>)#i) {
          $done = "false";
          $newline = $1;
          if ($newline =~ m#(hidden|submit|reset)#i) {
               $TheHTML =~ s/$newline//g;
          } elsif ($newline =~ m#checkbox#i) {
               $newline =~ m#(name=".*?")#i;
               $thename = $1;
               $thename =~ s/name="//i;
               chop $thename;
               if ($data{$thename}) {$TheHTML =~ s/$newline/$yes/g;}
                    else {$TheHTML =~ s/$newline/$yes/g;}
          } else {
               $newline =~ m#(name=".*?")#i;
               $thename = $1;
               $thename =~ s/name="//i;
               chop $thename;
               $TheHTML =~ s/$newline/$data{$thename}/g;
          }
     }
}

HTML code:

<input type="checkbox" name=test1 value="[Y]">test 1 <br><input 
type="checkbox" name=test2 value="[Y]">test 2
name <input type="text" name=name>


There, that ought to be helpful, I think.

Thanks again!!!!


===========================================================================

                             Mike Eggleston
                      nghtstr@michaelsmacshack.com
                   http://nghtstr.michaelsmacshack.com

                            Take the eTour!!
           http://www.etour.com/default.asp?associd=aff12270
===========================================================================



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org