Please use [code][/code]
tags around your code and data, to preserve formatting and to improve readability. Please do not use quote tags, colors, or other fancy formatting.
Go back and edit your earlier posts to include them too, please. As it stands, the long unbroken lines make my screen side-scroll.
I'm not very familiar with perl, but as I understand it, in general there's really no foolproof way to programmatically determine what language a string was written in. You can only use tricks and statistical methods. Checking what font or encoding is used is one, as suggested earlier. Or write up a test to see if the string contains characters other than those found in standard English. Or if the file is in a unicode encoding, test the characters to see if they fall within the Arabic range.
Also, a quick web search came up with this language detection plugin:
Otherwise, I think you really need to explain what you are trying to do in more detail if you want to get more specific help. Provide some realistic examples of the input, the output you want, and any relevant code you have written up so far.