regex - Opening a file in Ruby - unknown regexp options - Prgra ERROR? -
i trying open file , store contents useable input methods in separate file. specifically, have 1 file "test_int_file.rb", has 1 integer on each line. use each integer input method.
i have attempted open file using command in same file methods stored: file.open("/desktop/programs/test_int_file.rb")
my plan use following each line separate integer input (stored in array) can pass method:
file_arr = [] file.open("/desktop/programs/test_int_file.rb").each_line |line| file_arr << line.to_i end
so 2 main questions here:
1) when attempt file.open("/desktop/programs/test_int_file.rb") on mac, error in terminal: unknown regexp options - prgra doing wrong in opening file?
2) block of code above work input file of integers array of integers?
thanks in advance!
Comments
Post a Comment