[Israel.pm] diff between 2 perl ds

Offer Kaye offer.kaye at gmail.com
Sun Mar 13 04:15:10 PST 2005

On Sun, 13 Mar 2005 13:57:10 +0200, Itamar Elem wrote:
> hi
> is there amodule which can do diff between 2 perl data structures
> and return where are the diferences
> thanks
> itamar

To see if 2 data structures are different, and where they begin to
differ, use the "is_deeply" function from the Test::More module. For
more complete/complex comparisons, use one of:

Of course you could also try to roll-your-own by using Data::Dumper
and making sure array keys are sorted in the output (e.g. use
"$Data::Dumper::Sortkeys = 1") for each structure, but I think for 90%
of the cases one of the above modules should serve you well enough.

Offer Kaye

More information about the Perl mailing list