damian has asked for the wisdom of the Perl Monks concerning the following question:
i'm using the counter file to increment the file(num).txt. i don't know if i'm doing it right... please help me. thanks in advance.$template = "index.txt"; $counter = "counter.txt"; $pos = 0; $found = 0; $num = 0; open (F1, "+>$template"); @idxlines = <F1>; close F1; foreach $lines (@idxlines) { if ($lines =~ /<% INCLUDE file2.txt %>/) { $found = 1; last; } $pos++; } open (F1, "+<$template"); open (CT, "$counter"); $num = <CT>; close CT; if ($num == 2) { $num = "1" } else { $num++ } open(CT, ">$counter"); print CT $num; close CT; $idxlines[$pos] = "<% INCLUDE file$num.txt %>"; print F1 $idxlines[$pos]; close F1;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: modifying the search pattern of a file.
by davorg (Chancellor) on Jul 13, 2000 at 14:26 UTC | |
Re: modifying the search pattern of a file.
by le (Friar) on Jul 13, 2000 at 14:39 UTC | |
by dempa (Friar) on Jul 13, 2000 at 15:27 UTC | |
by turnstep (Parson) on Jul 13, 2000 at 22:15 UTC | |
by le (Friar) on Jul 13, 2000 at 15:35 UTC | |
Re: modifying the search pattern of a file.
by splinky (Hermit) on Jul 13, 2000 at 21:58 UTC | |
Re: modifying the search pattern of a file.
by t0mas (Priest) on Jul 13, 2000 at 16:43 UTC | |
RE: modifying the search pattern of a file. (short version)
by turnstep (Parson) on Jul 13, 2000 at 22:04 UTC |