Ok, so you DIDN'T do that. What was posted, and what you posted are completely different things.
First, try using explode.
Second, instead of using $raw_data, try plugging in the actual file. That may help.
Then, to help yourself debug, try printing out the contents of all your information before and after each modification that you do, that way you can see where your code is getting caught up.
echo $variable
//some code here
echo $resultofcodevariable