I have indeed read perlman:perlrun (several times this evening) and I recognize the code you are quoting from that source. I am sure all this seems pretty trivial to folk who use it all the time -- but it is daunting to the uninitiated. And frustrating. I could have writen several scripts to do this task using different and interesting approaches and taken a looong walk in the time I have spent on this trying to get some experience with command line switches. I am presuming upon your patience...

Okay: Encourged by your insistence, I finally found this bit in Camel 3, page 496: The -p loop also contains an implicit select(ARGVOUT); for each file.   perlrun just says, "Note that the lines are printed automatically." It omits to say at that point "to the file in question". It's probably there somewhere. And it's clear once you know it. I just missed it.

All of which brings my to my tired question (revised a little each time). And I ask again because this part is still not clear. Assuming that the files are already backed up, does not this simple line: %perl -pie 's/old/new/g' ./*/* do everything I need without the use of find.... When I am doing things on unfamiliar turf, I like (if possible) to keep it simple and clear.

Update: Still reading... perlrun does contain the explanation of the implicit select(ARGVOUT);. But, as in Camel 3 (which simply reprints the whole section) it is under the -i, not -p. IMHO, the briefer code given under -p is misleading since it claims to explain what -p does but fails to mention the implicit 'select'. This is a crucial detail and the reason I deliberately chose not to use it at first. I had no need to print to STDOUT (which is what the code under -p, as given, would do).


In reply to Re(4): Need one-liner to s///g in all sub-dirs by dvergin
in thread Need one-liner to s///g in all sub-dirs by dvergin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.