in reply to Re: Re: comparing arrays
in thread comparing arrays

Oh! Very good point! Quickly written code can and will have things like that overlooked!

*zing* Thanks!

_14k4 - perlmonks@poorheart.com (www.poorheart.com)

Replies are listed 'Best First'.
Re: Re: Re: Re: comparing arrays
by kappa (Chaplain) on Apr 04, 2002 at 15:51 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.
Re: Re: Re: Re: comparing arrays
by andye (Curate) on Apr 04, 2002 at 14:53 UTC
    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? :)
        I just meant, if you knew it wouldn't. Like maybe you've validated the contents already.

        andy.