in reply to Equal strings don't match!

The usual answer is that they do not match because they are different. Issues of different character sets, "hidden" spaces at the start or the end or EOL characters may mess up your test. Do a print "**$elem**\n"; before the test so you can see what you are comparing.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: Equal strings don't match!
by moritz (Cardinal) on Jul 30, 2008 at 18:16 UTC
    I agree that they are likely to be different, but simply printing them with a delimiter will not show all possible differences.

    This is what I use instead:

    use Data::Dumper; local $Data::Dumper::Useqq = 1; print Dumper($str1, $str2);
Re^2: Equal strings don't match!
by jettero (Monsignor) on Jul 30, 2008 at 18:13 UTC
    Also, I think the cmdline file has oddball characters in it sometimes...

    $elem =~ s/([^[:print]])/'\x'.unpack("H*", $1)/eg; might, therefore be revealing as well.

    -Paul