in reply to (ar0n: use 'eq') Re: Compare file content with a variable content
in thread Compare file content with a variable content

I have tried both approches (either use 'eq' or just insert the scalar value of the string (array) into both vars and use '==' to compare between them, but the function always returns the "the file is not the same" printout no matter if both strings 'looks' the same. Could it be that there is a space character or CR somewhere in that file that causes to the mismatch?
  • Comment on Re: (ar0n: use 'eq') Re: Compare file content with a variable content

Replies are listed 'Best First'.
I did it!
by Skyhawlk (Initiate) on May 20, 2001 at 18:14 UTC
    The string value was in fact surrounded by space characters so it was NOT the same as the other string. I have added some trimming:
    for ($modified_scalar) { s/^\s+//; s/\s+$//; }
    and it did the trick!