I don't understand the specific error message since there isn't a syntax error on the 'procedure' line, however the syntax for the 'files' command is in the wrong format. It should be:
files ("*.fits", \$this->_split2($m[0]) output//"list_master")
The difference is between the "compute mode" syntax you would use on the command line, and the "program mode" syntax used in scripts. Even so, I couldn't find a way to execute the script, change the newlines, etc that produced the same error message you got.
Also if anyone could help me with the syntax for making the output list prefix a user defined variable, that'd be great!!
I don't understand the question -- the prefix is the task parameter 'output'. If you mean an environment variable, then to set the variable you would do:
cl\$this->_split2($m[0]) set foo = "bar"
and then in the script use it as something like
print ("variable foo is " // envget ("foo"))