NoMethodError (...occurred while evaluating nil.split)

I am getting a NoMethodError, with the following decription:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split

The error is raised on function call line of the '.html.erb' file.

The function is present in the relevant 'helper.rb' file and contains
the following:

[code]
def splitBonusUnit(data)
  @returnValue = @data.split(/ /)
  return @returnValue
end
[/code]

The 'data' value passed into the function is confirmed to be "2 3"; when
the code @data.split(/ /) is entered into the Ruby shell it works and
expected and ["2", "3"] is returned.

Why is this not working correctly when put within the Ruby on Rails web
pages? If I take the 'split' command out of the helper function, it also
works correctly.

My understanding of Ruby and Ruby on Rails is limited, as is likely
obvious, so although I have found a way around it, I would appreciate a
pointer to why it does what it does.

Thank you.

Well; something told me it would be rather simple. Yet, I tried so many
things, but that.

Thank you.

Also, if you are not referring to @returnValue elsewhere, then there is
no need to make that an instance variable...

I agree, the variable was only created just on the off chance return on
the split command was the issue.

Again, thank you for your prompt reply.