On 01/21/2015 10:47 PM, Harry Putnam wrote:
Andrew Solomon <and...@geekuni.com> writes:

Hi Harry

I was about to try to explain it but sometimes a picture is worth a
thousand words (even if it's a picture of code:)
Yes, that did the job.  I guess I was pretty confused about what
`slurp' means... I was expecting the newlines to disappear.
why would you expect that? as i mentioned in another post, removing newlines from typical text files which are in one string means you can't tell where something starts and ends. all the text is together and that isn't useful in most cases. removing newlines from an array of lines is common.

But of course, I see now, that first off $/ is the `input record
separator and so would not do like what one might to with awk using
its output record separator:

awk 'BEGIN{ORS=""}{print}' bar.txt
   thisisavery long test

And secondly removing the new lines would probably introduce as many
problems as it might solve.
which is what i said. it can't help in general and will ruin many text formats.

I just had it in my head that the newlines were to be ditched
somehow. So when I saw the result of processing my .bashrc file (which
I only used because it was handy for testing), I thought I was doing
something wrong.  But ... it was working as advertised all the time.

and bash is one of those where removing newlines will break the code. tokens ending a line will be against tokens beginning a line.

uri

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to