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; }
In reply to Re: How to process multiple input files?
by jwkrahn
in thread How to process multiple input files?
by rnaeye
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |