damian has asked for the wisdom of the Perl Monks concerning the following question:
as you can see the line:open(FILE, $file) or die $!; @lines = <FILE>; close FILE; for ($i = 0; $i <= $#lines; $i++) { if ($lines[$i] =~ /<% INCLUDE exclusives(\d+)\.tmpl %>/) { $num = $1; $num = $num == 1 ? 3 : 1; $lines[$i] =~ s/<% INCLUDE exclusives(\d+)\.tmpl %>/<% INCLUDE ex +clusives$num\.tmpl %>/; } else { next; } open(FILE, ">$file") or die $!; print FILE @lines; close FILE;
knows the number of files which in this case 3 files. now if i delete a file it should replace 3 to just 2. the same if i add a file 3 will turn into 4.... how will i be able to replace the value (3) whenever i delete or add a file via web. thanks in advance.$num = $num == 1 ? 3 : 1;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: replacing values via web
by le (Friar) on Jul 18, 2000 at 13:37 UTC | |
(jjhorner)replacing values via web
by jjhorner (Hermit) on Jul 18, 2000 at 16:10 UTC | |
by le (Friar) on Jul 18, 2000 at 16:21 UTC | |
by nuance (Hermit) on Jul 18, 2000 at 16:59 UTC |