The stupid question is the question not asked | |
PerlMonks |
Re: header footerby kcott (Archbishop) |
on Mar 04, 2014 at 22:13 UTC ( [id://1076984]=note: print w/replies, xml ) | Need Help?? |
G'day gupr1980, Welcome to the monastery. Your substitution regex has little bearing on the task you describe. You might want to get up to speed on Perl's regular expresions by reading "perlrequick - Perl regular expressions quick start" and "perlretut - Perl regular expressions tutorial". Having said that, I see no reason to use regular expressions here: substr is quite capable of doing this (and I'd expect it to be a lot faster). Here's an example script, pm_1076973.pl, with much short header and footer lengths for demo purposes:
Here's the starting files (before that script is run):
Now run the script:
Now the files look like this:
-- Ken
In Section
Seekers of Perl Wisdom
|
|