Array to string conversion

I have an array called l that contains 161 lines of text. I created it
using l = and then listing the lines of text. I then wanted to
convert it to a string (called f) so I could apply downcase, gsub, and
split to it. I used these lines:

f = l.to_s
f.downcase.gsub(/[.,-1234567890;:’"()]/, ’ ').split = FedPaper1

However, I keep getting an “undefined local variable or method ‘f’ for
main:Object (NameError)”. What can I do to fix it? Thanks in advance!

Your code snippet will fail because it tries to assign global var
FedPaper1 to the array that results from the split operation.
You can’t assign anything to an anonymous result.

If you’re trying to test that the result equals FedPaper1, try:

f.downcase.gsub(/[.,-1234567890;:'"()]/, ' ').split == FedPaper1

If you’re trying to assign the result to the FedPaper1 var, try:

FedPaper1 = f.downcase.gsub(/[.,-1234567890;:'"()]/, ' ').split