in reply to Unknown File Operation

parshtml:

Off the top of my head, it appears to be that you would get what you want if you reduce the scope of your $data variable. The clause:

while (<FILE>) { $data1 .= $_; }

is adding to $data on each loop. So you could either:

  • Add the statement $data=''; just before that while loop, or
  • Add the statement my $data; just before that while loop, or
  • Slurp in the file in a single statement, replacing $data instead of appending to it, like:
  • $data = <FILE>;

    ...roboticus