Next Lightweight Databases 55

Tie::File Examples

How do I insert a line in the middle of a file?

        for my $n (0 .. $#LINE) {
          if ($LINE[$n] =~ /<!--insert here-->/) {
            splice @LINE, $n+1, 0, $new_html_text;
            last;
          }
        }
        untie @LINE;        


Next Copyright © 2003 M. J. Dominus