OK, I have updated the script to this.. It renames the file corrctly but I get no output in the renamed file.
use File::Find;
use strict;
my $bak_ext = '.bak';
my $root_dir = 'C:/Temp/Chris/';
find(\&fix, $root_dir);
sub fix {
# if the extension fits...
if ( /\.xml?/i ) {
print "Processing $_\n";
my $new = $_;
my $bak = $_ . $bak_ext;
rename $_, $bak or die "Cannot rename $_ to $bak: $!";
open OUTPUT, "> $new" or die "Cannot open $new for writing: $!
+";
while ( <OUTPUT> ) {
Print Go Go Go;
my $TheLine = $_;
s/<label>([^<]*<\/label>)/<label denominator=no auto.number=no>$1/i;
print OUTPUT;
}
}
close OUTPUT;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.