Has /foo/../bah/ changed?


(Ron Jeffries) #1

So on my old machine, this code seems to work differently from on the
new:

def procfile (input, output)
@printfile = true
while input.gets
if /<header/…/</header/
procline(input, $_, output)
end
end
end

On the old machine, only lines between a line that containing
"<header" and one containing “</header” are processed.

On the new machine, running ruby 1.8.1, all the lines in the whole
file (input) are processed.

What up with that, any clues?

Thanks!

···


Ron Jeffries
www.XProgramming.com
I’m giving the best advice I have. You get to decide if it’s true for you.


(Guillaume Marcais) #2

So on my old machine, this code seems to work differently from on the
new:

def procfile (input, output)
@printfile = true
while input.gets
if /<header/…/</header/
procline(input, $_, output)
end
end
end

Change it to (untested):

def procfile (input, output)
@printfile = true
while l = input.gets
if l =~ /<header/ … l =~ /</header/
procline(input, l, output)
end
end
end

The flipflop operator may/will disappear in the next revision of Ruby.
Do a search on ruby-talk for lengthy discussions on wether or not to
save flipflop.

Guillaume.

···

On Mon, 2004-02-16 at 16:04, Ronald E Jeffries wrote:

On the old machine, only lines between a line that containing
"<header" and one containing “</header” are processed.

On the new machine, running ruby 1.8.1, all the lines in the whole
file (input) are processed.

What up with that, any clues?

Thanks!


Ron Jeffries
www.XProgramming.com
I’m giving the best advice I have. You get to decide if it’s true for you.


(Ron Jeffries) #3

Thanks!

In what way are these improvements?

Thanks again,

···

On Tue, 17 Feb 2004 07:54:10 +0900, Guillaume Marcais guslist@free.fr wrote:

Change it to (untested):

def procfile (input, output)
@printfile = true
while l = input.gets
if l =~ /<header/ … l =~ /</header/
procline(input, l, output)
end
end
end

The flipflop operator may/will disappear in the next revision of Ruby.
Do a search on ruby-talk for lengthy discussions on wether or not to
save flipflop.


Ron Jeffries
www.XProgramming.com
I’m giving the best advice I have. You get to decide if it’s true for you.


(Robert) #4

“Ronald E Jeffries” ronjeffries@acm.org schrieb im Newsbeitrag
news:s3v230pnp6tkroucj9rvhp007i5cn429dl@4ax.com

···

On Tue, 17 Feb 2004 07:54:10 +0900, Guillaume Marcais > guslist@free.fr wrote:

Change it to (untested):

def procfile (input, output)
@printfile = true
while l = input.gets
if l =~ /<header/ … l =~ /</header/
procline(input, l, output)
end
end
end

The flipflop operator may/will disappear in the next revision of Ruby.
Do a search on ruby-talk for lengthy discussions on wether or not to
save flipflop.

Thanks!

In what way are these improvements?

The meaning of “…” changes when in the context of “if”,
“unless”, “while” etc. This is not obviuos. For further reference see
the lengthy discussion.

robert