in reply to Re: regular expression
in thread regular expression

Hello I changed my program . And added the features you suggested. I know a better way must exist . Can any one help.
$openx = open(BAKFIL, "<data.txt"); open(BAKFIL2, ">data.bak.txt"); if ( ! $openx ) { print "Content-type:text/html\n\n"; print "File Does not exist. Program will now abort"; close( BAKFIL ); close( BAKFIL2 ); unlink( "data.bak.txt"); exit ; } else { while(<BAKFIL>) { print BAKFIL2 $_; } close( BAKFIL ); close( BAKFIL2 ); } my $filesize = -s "data.txt"; open(XFIL,"data.txt") || die $!; @main = <XFIL>; close(XFIL); open(XFIL,">data.txt") || die $!; foreach $main_line (@main) { print XFIL $main_line; if ($main_line =~ /The marker line/) { print XFIL "Hello\n"; } } close(XFIL); my $filesizemain = -s "data.txt"; if ($filesizemain < $filesize) { open(BAKFIL2, "<data.bak.txt") || die $!; open(BAKFIL, ">data1313.txt") || die $!; while(<BAKFIL2>) { print BAKFIL $_; } close( BAKFIL2 ); close( BAKFIL );