in reply to Its not working.. String works but not split

When Perl says that two things are not equal, Perl is right.

My guess is that at least one of the two strings has whitespace in front of it or at its end. You should print both out, for example with delimiters at their front and end:

print "String1: >$string1<\n"; print "String2: >$string2<\n";

You posted some code in your question, but it would be easier to pinpoint your exact error if you had reduced your code to a small, yet self-contained example that still reproduces the behaviour you observe. I find that in most cases, by reducing my code I already find the error myself. My personal guess is that you left a trailing newline on the string that you read from a file.