in reply to How to process multiple input files?
You need to reset $count for each file. Something like this (UNTESTED):
#!/usr/bin/perl use strict; use warnings; $^I = ".bak"; undef $/; my $count = 0; while ( my $line = <> ) { $line =~ s{ (<\/div>) } { ++$count == 2 ? "\t<?php include(\$_SERVER['DOCUMENT_ROOT'].\"\/includes +\/footer.php\"); ?>\n\n$1" : $1 }gex; print $line; $count = 0; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to process multiple input files?
by John M. Dlugosz (Monsignor) on May 23, 2011 at 00:22 UTC | |
by jwkrahn (Abbot) on May 23, 2011 at 06:44 UTC | |
by John M. Dlugosz (Monsignor) on May 23, 2011 at 17:22 UTC | |
by Anonymous Monk on May 23, 2011 at 18:48 UTC | |
by John M. Dlugosz (Monsignor) on May 23, 2011 at 19:22 UTC | |
| |
Re^2: How to process multiple input files?
by rnaeye (Friar) on May 22, 2011 at 21:50 UTC |