in reply to Re: comparing arrays
in thread comparing arrays

IMHO, better to join them with a character that you know doesn't appear in the array's contents, e.g. \0 or pipe or something. Otherwise - unless I'm misunderstanding your code - it'll think ('ab', 'c') equals ('a', 'bc').

Cheers,
andy.

Replies are listed 'Best First'.
Re: Re: Re: comparing arrays
by one4k4 (Hermit) on Apr 04, 2002 at 14:45 UTC
      I thinks, that this is a question not of quick coding, but of losing valueable information about the structure of your data. You can compare some derivatives of the arrays if and only if that's a reversible derivative. Think of stringification of an array which could always be transformed back into the original array. You could e.g. escape all spaces in the array components and then join with spaces. This would yield a string which can be used for comparison.
      No problemo. Actually, rather than using join(), I'd be tempted to do something like this:
      { local $" = "\0"; print "match" if "@a" eq "@b"; }
      (not tested, may have typos).

      andy.

        And why do you think, that "\0" is not going to happen inside array contents? :)