All
I am new to Ruby and to OO programming.

I need to get the following done which I have written in a function:-

  def SplitCode(sCodeFile,sListFile)
  #             param1: file to extract code from
  #                       param2: file list to verify with
  #   read param1. If &&&&& is found, close OUT file if open.
    fReadCodeFile = File.new(sCodeFile,'r')
    while (sLine = fReadCodeFile.gets)
  #
      if (sLine == "&&&&&")
        fWriteCodeFile.close if !(fWriteCodeFile.closed?)
        fWriteCodeFile = File.new(fReadCodeFile.gets,'w')
      end # if sLine == &&&& ...
  #
      if (sLine != "=====")
        fWriteCodeFile.puts sLine
      end # if sLine != ====
  #
    end # while...
   fWriteCodeFile.close if !(fWriteCodeFile.closed?)
   fReadCodeFile.close  if !(fReadCodeFile.closed?)
  end #end of function

What I need is to be able to pass the arguments to the function and call
it.
Do I need to:
./mycode.rb file1.txt file2.txt

Thanks in advance for any help.
-- 
Posted via http://www.ruby-forum.com/.