Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Equal strings don't match!

by CountZero (Bishop)
on Jul 30, 2008 at 18:12 UTC ( [id://701202]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://701202]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2026-02-12 01:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.