$VAR = a Value doesnt assign "a Value" to "$VAR" rather to "$VAR " So using $VAR won't work in your code Same thing for the VALUE. just trim() the extracted values!