I can't offer any explanations why it isn't working for
\n\r but I can offer some suggestions:
undef $/;
$filecontemts=<DEFILE>
will slurp all of the file into $filecontents, then you don't need to worry about using
join.
print "Changing \"$File::Find::name\" file...\n" if ($happens=($file_c
+ontents =~ s/$changefrom/$changeto/g));
should make the substitution and return the number of times it happened all at once. It will only print if $happens isn't zero. It's a little hard to read, but you get used to it quickly. Then you are only doing one regex on the data, rather than two. (vice versa for case insensitive matching.)
I don't know if
if($code =~ m/yY/) would be faster than testing for equality, but it is easier to read (at least for me anyway. YMMV)
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.