Re: Converting a textfile-like string to an array and back

2003-02-10 Thread A. Pagaltzis
* Andrew Savige [EMAIL PROTECTED] [2003-02-10 17:54]: *whistle* *whistle* *red card* *disqualified* multiplying by length (x+length) will not give the desired result here; it must be boolean (0 or 1 only). Doh! Of course. I'm an idiot. *grmbl* -- Regards, Aristotle

Re: Converting a textfile-like string to an array and back

2003-02-10 Thread Eugene van der Pijll
Andrew Savige schreef: Aristotle golfed: $_=$x;@lines=(/^.*/mg)x+length; Against my better judgment, I will have a go at golfing this: $_=$x;@l=(/^.*/mg)x/./s This clobbers $_. Not nice for the rest of the program. Correct is: {local$_=$x;@l=(/^.*/mg)x/./s} or

Re: Converting a textfile-like string to an array and back

2003-02-10 Thread A. Pagaltzis
* Eugene van der Pijll [EMAIL PROTECTED] [2003-02-10 18:35]: Unfortunately, you had use strict in your first post, and neither of these are use-strict safe. Oh? What makes you say so? -- Regards, Aristotle

Re: Converting a textfile-like string to an array and back

2003-02-10 Thread Andrew Savige
(-ugene sprak: Andrew Savige schreef: Aristotle golfed: $_=$x;@lines=(/^.*/mg)x+length; Against my better judgment, I will have a go at golfing this: $_=$x;@l=(/^.*/mg)x/./s This clobbers $_. Not nice for the rest of the program. Correct is:

Re: Converting a textfile-like string to an array and back

2003-02-10 Thread Yitzchak Scott-Thoennes
On Mon, 10 Feb 2003 11:09:25 +1100 (EST), [EMAIL PROTECTED] wrote: Yitzchak Scott-Thoennes wrote: Sigh. I'd call that a bug if someone hadn't gone to the trouble to test for it and document it. (Indeed, I see a bug report out there: #6653, was 20010327.008.) So do something like: my

Re: Converting a textfile-like string to an array and back

2003-02-10 Thread Keith C. Ivey
Yitzchak Scott-Thoennes [EMAIL PROTECTED] wrote: Only if you say $x eq means no lines instead of one empty line missing its \n :) Well, the subject line does say textfile-like, and a 0-byte text file has no lines, not one empty line. -- Keith C. Ivey [EMAIL PROTECTED] Washington, DC

Re: Converting a textfile-like string to an array and back

2003-02-10 Thread Yitzchak Scott-Thoennes
On Mon, 10 Feb 2003 23:44:14 -0500, [EMAIL PROTECTED] wrote: Yitzchak Scott-Thoennes [EMAIL PROTECTED] wrote: Only if you say $x eq means no lines instead of one empty line missing its \n :) Well, the subject line does say textfile-like, and a 0-byte text file has no lines, not one empty