Can you please show us what the contents of the file looks like? That'll help a lot to think about adjusting your function or even recoding something else. Thank you.
Cordialement
Sorry for late reply.
I pasted content here
http://pastebin.com/f7938799f@Thrull,
Just reading the first line went well so far. But if $read isn't gonna work changing it to $fread isn't such a big problem i think