On Sun, Feb 6, 2011 at 9:01 PM, Brian Candler <b.candler / pobox.com> wrote:
> Bigmac Turdsplash wrote in post #979843:
>> mply=0
>> kill=0
>> open("list.lfi","rb").each do |block|

Another remark: you do not close the IO object properly that is opened
in the line above.  Rather do

File.open("list.lfi","rb") do |io|
  io.each do |block|
    ...
  end
end

Btw, I'd consider "line" a better name for the block parameter here.
Although: you open the file with mode "rb" but use a line based
parsing scheme (by using IO#each) - that looks at least odd.

>> ['lol', '%00'].each do |suffix|
>> while mply < 10

Why do you use a while loop here?  Doesn't really look reasonable
since you process the same line (variable "block") over and over
again.

>> if block.include? ".log"
>> puts suffix
>> suffix
>> kill=1
>> break
>> print("!!! Check your log.html !!!")
>> end
>> if kill==1; break;end
>> mply=mply+1
>> end
>> if kill==1; break;end
>> mply=0
>> end
>> if kill==1; break;end
>> end
>>
>> print suffix.last
>>
>>
>>
>> i always do things the hard way... i dont know how to get suffix out
>> side of the loop...

This really looks overly hard.  Can you describe what that code is
supposed to do?

Cheers

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/