I have a Wordpad file from which I extract two strings and compare them. In this case they are both equal, but I cannot use the =~
expression to evaluate them.
if($pin_list =~ /$lvl_list/){ do something}
What I have tried in debug mode:
- Both strings are equal as evaluated by
eq
- Both strings are equal as evaluated by
==
- Manually set another variable to same string and then perform
if
statement with new variable;if($pin_list =~ /$x/){do something}
. This attempt was successful. - Performed
chomp(var)
on both string vars several times and then ran code. FAILED - Removed carriage return via
$tst_pins =~ s/\n//g
on both vars. FAILED - Length of both vars is the same.
- Manual printed both vars and visually verified both strings are the same.
Anyone got any ideas? I suspect it is something that has to do with WordPad and perhaps a hidden char, but don't know how to track it down.
tchrist -> Good question. In this case the strings are equal, but that will not always be the case. Under normal conditions, I am simply looking for the one string to be a subset of another.
For those who may be interested. Problem solved.
I had a string that i 'joined' with '+'. So the string looked like the following:
"1+2+3+4+a+b+etc"
The '+' ended up being the problem. At the suggestion of a colleague I performed a substr and whittled away one of the strings down to the offending point. It occurred just after it captured the '+'. I then joined using a blank space instead of the '+', and everything works.
Using different characters other than the alphabet will have an impact that I still am at a loss as to explain why when everything else said it was equal.
Bret